本文整理汇总了C#中DatabaseSchemaReader.SqlGen.DdlGeneratorFactory.RenameColumn方法的典型用法代码示例。如果您正苦于以下问题:C# DdlGeneratorFactory.RenameColumn方法的具体用法?C# DdlGeneratorFactory.RenameColumn怎么用?C# DdlGeneratorFactory.RenameColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseSchemaReader.SqlGen.DdlGeneratorFactory
的用法示例。
在下文中一共展示了DdlGeneratorFactory.RenameColumn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMySqlWithSchema
public void TestMySqlWithSchema()
{
//arrange
var migration = new DdlGeneratorFactory(SqlType.MySql).MigrationGenerator();
var table = MigrationCommon.CreateTestTable("Orders");
table.SchemaOwner = "dbo";
var column = table.FindColumn("NAME");
column.Name = "NEWNAME";
//act
var sql = migration.RenameColumn(table, column, "OldName");
//assert
Assert.IsTrue(sql.Contains("ALTER TABLE `dbo`.`Orders` CHANGE `OldName` `NEWNAME` VARCHAR (10) NOT NULL"), "names should be quoted correctly");
}
示例2: TestDb2
public void TestDb2()
{
//arrange
var migration = new DdlGeneratorFactory(SqlType.Db2).MigrationGenerator();
var table = MigrationCommon.CreateTestTable("Orders");
table.SchemaOwner = "dbo";
var column = table.FindColumn("NAME");
column.Name = "NEWNAME";
//act
var sql = migration.RenameColumn(table, column, "OldName");
//assert
Assert.IsTrue(sql.Contains("ALTER TABLE \"dbo\".\"Orders\" RENAME COLUMN \"OldName\" TO \"NEWNAME\""), "names should be quoted correctly");
}
示例3: TestSqlServerWithSchema
public void TestSqlServerWithSchema()
{
//arrange
var migration = new DdlGeneratorFactory(SqlType.SqlServer).MigrationGenerator();
var table = MigrationCommon.CreateTestTable("Orders");
table.SchemaOwner = "dbo";
var column = table.FindColumn("NAME");
column.Name = "NEWNAME";
//act
var sql = migration.RenameColumn(table, column, "OldName");
//assert
Assert.IsTrue(sql.Contains("sp_rename '[dbo].[Orders].[OldName]', '[NEWNAME]', 'COLUMN'"), "names should be quoted correctly");
}
示例4: TestSqLite
public void TestSqLite()
{
//arrange
var migration = new DdlGeneratorFactory(SqlType.SQLite).MigrationGenerator();
var table = MigrationCommon.CreateTestTable("Orders");
table.SchemaOwner = "dbo";
var column = table.FindColumn("NAME");
column.Name = "NEWNAME";
//act
var sql = migration.RenameColumn(table, column, "OldName");
//assert
Assert.IsTrue(sql.StartsWith("--", StringComparison.OrdinalIgnoreCase), "Cannot be changed in SQLite");
}