public static void AlterDatabase(this IAlterProcessor proc, DatabaseInfo src, DatabaseInfo dst, DatabaseInfo targetDb, DbDiffOptions opts, Action <AlterPlan> extendPlan) { AlterPlan plan = new AlterPlan(targetDb); DbDiffTool.AlterDatabase(plan, src, dst, opts); if (extendPlan != null) { extendPlan(plan); } plan.Transform(proc.AlterCaps, opts); var run = plan.CreateRunner(); run.Run(proc, opts); }
private void CreateActions() { _plan = new AlterPlan(_dst); DbDiffTool.AlterDatabase(Plan, new DbObjectPairing(_dst, _src), _options); DbDiffAction lastAlterTable = null; foreach (var op in _plan.Operations) { DbDiffAction act; if (op.ParentTable != null) { // this operation should be added to ALTER TABLE operation if (lastAlterTable == null || lastAlterTable.ParentTable != op.ParentTable) { lastAlterTable = new DbDiffAction(this); lastAlterTable.ParentTable = op.ParentTable; lastAlterTable.AfterCreate(); _actions.Elements.Add(lastAlterTable); } act = new DbDiffAction(this); act.Operation = op; //act.IsChecked = true; act.AfterCreate(); lastAlterTable.Elements.Add(act); } else { act = new DbDiffAction(this); act.Operation = op; lastAlterTable = null; act.AfterCreate(); _actions.Elements.Add(act); } } //this.AlterDatabase(m_dst, m_src, m_options); }