public void FkCheckNoCheckTest() { var version = MsSqlVersion.MsSql2016; var dd = new TestDatabaseFk(); dd.SetVersions(version.GetTypeMapper()); Init(version, dd); var ddlReader = DataDefinitionReaderFactory.CreateDataDefinitionReader( SqlExecuterTestAdapter.ConnectionStrings[version.UniqueName] , SqlExecuterTestAdapter.GetContext(version), dd.GetSchemaNames().ToList()); var ddInDatabase = ddlReader.GetDatabaseDefinition(); var fk = dd.GetTable("Foreign").Properties.OfType <ForeignKey>().First(); Assert.AreEqual("true", fk.SqlEngineVersionSpecificProperties[version, "Nocheck"]); fk.SqlEngineVersionSpecificProperties[version, "Nocheck"] = "false"; var comparer = new Comparer(SqlExecuterTestAdapter.GetContext(version)); var changes = comparer.Compare(ddInDatabase, dd); _ = changes[0] as ForeignKeyChange; _ = new DatabaseMigrator(SqlExecuterTestAdapter.GetExecuter(version.UniqueName), SqlGeneratorFactory.CreateMigrationGenerator(version, SqlExecuterTestAdapter.GetContext(version))); // TODO change FK // databaseMigrator. }
public void FkCheckNoCheckTest() { var version = MsSqlVersion.MsSql2016; var ddOriginal = new TestDatabaseFk(); ddOriginal.SetVersions(version.GetTypeMapper()); var ddFkChanged = new TestDatabaseFk(); ddFkChanged.SetVersions(version.GetTypeMapper()); var fk = ddFkChanged.GetTable("Foreign").Properties.OfType <ForeignKey>().First(); fk.SqlEngineVersionSpecificProperties[version, "Nocheck"] = "false"; var changeDocumenter = new ChangeDocumenter(DataDefinitionDocumenterTestsHelper.CreateTestChangeContext(version), version, "TestDatabaseFk", "TestDatabaseFk_FkCheckNoCheckTest"); changeDocumenter.Document(ddOriginal, ddFkChanged); }