Exemple #1
0
        public void Generate_can_handle_update_database_operations()
        {
            var migrationSqlGenerator = new SqlCeMigrationSqlGenerator();
            var providerInvariantName = ProviderRegistry.SqlCe4_ProviderInfo.ProviderInvariantName;

            var historyRepository
                = new HistoryRepository(
                      new SqlCeConnectionFactory(providerInvariantName)
                      .CreateConnection("Foo").ConnectionString,
                      DbProviderFactories.GetFactory(providerInvariantName),
                      "MyKey",
                      null);

            var updateDatabaseOperation
                = new UpdateDatabaseOperation(historyRepository.CreateDiscoveryQueryTrees().ToList());

            updateDatabaseOperation.AddMigration("M1", new [] { new DropColumnOperation("Customers", "Foo") });

            var sql = migrationSqlGenerator.Generate(new[] { updateDatabaseOperation }, "2008").Join(s => s.Sql, Environment.NewLine);

            Assert.Equal(@"ALTER TABLE [Customers] DROP COLUMN [Foo]", sql);
        }
Exemple #2
0
 internal override IEnumerable <DbQueryCommandTree> CreateDiscoveryQueryTrees()
 {
     return(_historyRepository.CreateDiscoveryQueryTrees());
 }