Beispiel #1
0
        public void Generate_DatabaseCollationOperation_produce_valid_statement()
        {
            var operation = new DatabaseCollationOperation("TestsDB", SqlServerDatabaseCollations.Latin1_General_CI_AS);

            var sqlGenerator = new ExtendedSqlServerMigrationSqlGenerator();

            var sql = sqlGenerator.Generate(new MigrationOperation[] { operation }, "2008").Join(ss => ss.Sql, Environment.NewLine);

            Assert.Contains("ALTER DATABASE TestsDB COLLATE Latin1_General_CI_AS", sql);
        }
        /// <summary>
        /// Generate a SQL to alter collation in database
        /// </summary>
        /// <param name="databaseCollationOperation">The operation to produce sql for.</param>
        public virtual void Generate(DatabaseCollationOperation databaseCollationOperation)
        {
            using (var writer = Writer())
            {
                writer.WriteLine(
                    "ALTER DATABASE {0} COLLATE {1}",
                    databaseCollationOperation.DatabaseName,
                    databaseCollationOperation.Collation);

                this.Statement(writer);
            }
        }