当前位置: 首页>>代码示例>>C#>>正文


C# DdlGeneratorFactory.RenameColumn方法代码示例

本文整理汇总了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");
        }
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:16,代码来源:MigrationRenameColumn.cs

示例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");
        }
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:16,代码来源:MigrationRenameColumn.cs

示例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");
        }
开发者ID:Petran15,项目名称:dbschemareader,代码行数:17,代码来源:MigrationRenameColumn.cs

示例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");
        }
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:16,代码来源:MigrationRenameColumn.cs


注:本文中的DatabaseSchemaReader.SqlGen.DdlGeneratorFactory.RenameColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。