public ForeignKeyInfo CloneForeignKey(TableInfo ownTable = null) { var res = new ForeignKeyInfo(ownTable ?? OwnerTable); res.Assign(this); return(res); }
public virtual void CreateForeignKey(ForeignKeyInfo fk) { Put("^alter ^table %f ^add ", fk.OwnerTable); CreateForeignKeyCore(fk); EndCommand(); }
public virtual void DropForeignKey(ForeignKeyInfo fk) { DropConstraint(fk); }
protected virtual void CreateForeignKeyCore(ForeignKeyInfo fk) { if (fk.ConstraintName != null) Put("^constraint %i ", fk.ConstraintName); Put("^foreign ^key ("); ColumnRefs(fk.Columns); Put(") ^references %f", fk.RefTableFullName); if (fk.RefColumns != null) { WriteRaw("("); ColumnRefs(fk.RefColumns); WriteRaw(")"); } string ondelete = fk.OnDeleteAction.SqlName(); string onupdate = fk.OnUpdateAction.SqlName(); if (ondelete != null) Put(" ^on ^delete %k", ondelete); if (onupdate != null) Put(" ^on ^update %k", onupdate); }
public void CreateForeignKey(ForeignKeyInfo fk) { _database.FindTable(fk.OwnerTable).AddConstraint(fk); }
public void DropForeignKey(ForeignKeyInfo fk) { _database.FindTable(fk.OwnerTable).DropConstraint(fk); }
public ForeignKeyInfo CloneForeignKey(TableInfo ownTable = null) { var res = new ForeignKeyInfo(ownTable ?? OwnerTable); res.Assign(this); return res; }