private static void AddTable(TestDatabaseSimple dd) { var newTable = new SqlTable { SchemaAndTableName = "NewTableToMigrate" }; newTable.AddInt32("Id", false).SetPK().SetIdentity(); new PrimaryKeyNamingDefaultStrategy().SetPrimaryKeyName(newTable.Properties.OfType <PrimaryKey>().First()); newTable.AddNVarChar("Name", 100); dd.AddTable(newTable); }
#pragma warning disable IDE1006 // Naming Styles public void _010_GenerateScriptAndCreateTable(SqlEngineVersion version) #pragma warning restore IDE1006 // Naming Styles { _sqlExecuterTestAdapter.Check(version); _sqlExecuterTestAdapter.InitializeAndCreate(version.UniqueName); var dd = new DatabaseDefinition(null, new[] { MsSqlVersion.MsSql2016.GetTypeMapper(), OracleVersion.Oracle12c.GetTypeMapper(), SqLiteVersion.SqLite3.GetTypeMapper() }); var table = new SqlTable("HierarchyFromCsvToSqlTests"); var column = table.AddInt32("Id"); column.Properties.Add(new Identity(column) { Increment = 1, Seed = 1 }); table.AddNVarChar("Name", 100); dd.AddTable(table); var context = new Context { Settings = TestHelper.GetDefaultTestSettings(version), Logger = TestHelper.CreateLogger() }; var generator = SqlGeneratorFactory.CreateGenerator(version, context); var sql = generator.CreateTable(table); var result = _sqlExecuterTestAdapter.ExecuteNonQuery(version.UniqueName, sql); if (result != null) { Assert.Inconclusive(result); } }