示例#1
0
        private void TestTableDiff(string tableName, Action <TableInfo> mangle)
        {
            var dbinfo           = FullAnalyse();
            var table            = dbinfo.FindTableLike(tableName);
            var alteredTableInfo = table.CloneTable();

            mangle(alteredTableInfo);

            var       caps = DatabaseFactory.DumperCaps;
            var       opts = new DbDiffOptions();
            AlterPlan plan = DbDiffTool.PlanAlterTable(table, alteredTableInfo, opts, dbinfo);

            plan.AddLogicalDependencies(caps, opts);
            plan.Transform(caps, opts);

            string sql = GenerateScriptForPlan(plan);

            _output.WriteLine(sql);

            RunPlan(plan);

            var newStructure = FullAnalyse();
            var newTableInfo = newStructure.FindTableLike(tableName);

            AssertEqual(alteredTableInfo, newTableInfo);
        }
示例#2
0
        public AlterPlan GetPlanForThis(IDatabaseSource targetDb, bool ignoreMyChecked)
        {
            var plan = new AlterPlan();

            plan.Structure = new DatabaseStructure(m_diff.Target);
            GetOperations(plan, ignoreMyChecked);
            plan.Transform(m_diff.m_dialect.DumperCaps, m_diff.m_options, targetDb);
            return(plan);
        }