本文整理汇总了C#中FluentMigrator.Runner.MigrationRunner.Up方法的典型用法代码示例。如果您正苦于以下问题:C# MigrationRunner.Up方法的具体用法?C# MigrationRunner.Up怎么用?C# MigrationRunner.Up使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluentMigrator.Runner.MigrationRunner
的用法示例。
在下文中一共展示了MigrationRunner.Up方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanUseCustomVersionInfo
public void CanUseCustomVersionInfo()
{
ExecuteWithSupportedProcessors(processor =>
{
var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), new RunnerContext(new TextWriterAnnouncer(System.Console.Out)) { Namespace = "FluentMigrator.Tests.Integration.Migrations.Interleaved.Pass3" }, processor);
IVersionTableMetaData tableMetaData = new TestVersionTableMetaData();
//ensure table doesn't exist
if (processor.TableExists(tableMetaData.SchemaName, tableMetaData.TableName))
runner.Down(new VersionMigration(tableMetaData));
//ensure schema doesn't exist
if (processor.SchemaExists(tableMetaData.SchemaName))
runner.Down(new VersionSchemaMigration(tableMetaData));
runner.Up(new VersionSchemaMigration(tableMetaData));
processor.SchemaExists(tableMetaData.SchemaName).ShouldBeTrue();
runner.Up(new VersionMigration(tableMetaData));
processor.TableExists(tableMetaData.SchemaName, tableMetaData.TableName).ShouldBeTrue();
runner.Down(new VersionMigration(tableMetaData));
processor.TableExists(tableMetaData.SchemaName, tableMetaData.TableName).ShouldBeFalse();
runner.Down(new VersionSchemaMigration(tableMetaData));
processor.SchemaExists(tableMetaData.SchemaName).ShouldBeFalse();
}, true, typeof(SqliteProcessor));
}
示例2: CanApplyForeignKeyConventionWithSchema
public void CanApplyForeignKeyConventionWithSchema()
{
ExecuteWithSupportedProcessors(
processor =>
{
var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);
runner.Up(new TestForeignKeyNamingConventionWithSchema());
processor.ConstraintExists("TestSchema", "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();
runner.Down(new TestForeignKeyNamingConvention());
}, false, typeof(SqliteProcessor));
}
示例3: CanAlterColumnWithSchema
public void CanAlterColumnWithSchema()
{
ExecuteWithSupportedProcessors(
processor =>
{
var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);
runner.Up(new TestCreateSchema());
runner.Up(new TestCreateAndDropTableMigrationWithSchema());
processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();
runner.Up(new TestAlterColumnWithSchema());
processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();
runner.Down(new TestAlterColumnWithSchema());
processor.ColumnExists("TestSchema", "TestTable2", "Name2").ShouldBeTrue();
runner.Down(new TestCreateAndDropTableMigrationWithSchema());
runner.Down(new TestCreateSchema());
}, true, new[] { typeof(SqliteProcessor), typeof(FirebirdProcessor) });
}
示例4: CanRunMigration
public void CanRunMigration()
{
ExecuteWithSupportedProcessors(processor =>
{
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor);
runner.Up(new TestCreateAndDropTableMigration());
processor.TableExists("TestTable").ShouldBeTrue();
runner.Down(new TestCreateAndDropTableMigration());
processor.TableExists("TestTable").ShouldBeFalse();
});
}
示例5: CanApplyIndexConvention
public void CanApplyIndexConvention()
{
var connection = new SqlConnection(sqlServerConnectionString);
connection.Open();
var processor = new SqlServerProcessor(connection, new SqlServerGenerator());
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor);
runner.Up(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeTrue();
runner.Down(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeFalse();
}
示例6: CanRunMigration
public void CanRunMigration()
{
ExecuteWithSupportedProcessors(processor =>
{
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor, new TextWriterAnnouncer(System.Console.Out), new StopWatch());
runner.Up(new TestCreateAndDropTableMigration());
processor.TableExists("TestTable").ShouldBeTrue();
runner.Down(new TestCreateAndDropTableMigration());
processor.TableExists("TestTable").ShouldBeFalse();
});
}
示例7: CanApplyIndexConvention
public void CanApplyIndexConvention()
{
ExecuteWithSupportedProcessors(
processor =>
{
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor, new TextWriterAnnouncer(System.Console.Out), new StopWatch());
runner.Up(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeTrue();
runner.Down(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeFalse();
});
}
示例8: CanApplyIndexConvention
public void CanApplyIndexConvention()
{
ExecuteWithSupportedProcessors(
processor =>
{
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor);
runner.Up(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeTrue();
runner.Down(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeFalse();
});
}
示例9: CanApplyForeignKeyConvention
public void CanApplyForeignKeyConvention()
{
var connection = new SqlConnection(sqlServerConnectionString);
connection.Open();
var processor = new SqlServerProcessor(connection, new SqlServerGenerator());
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor);
runner.Up(new TestForeignKeyNamingConvention());
processor.TableExists("Users").ShouldBeTrue();
processor.ConstraintExists( "Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();
runner.Down(new TestForeignKeyNamingConvention());
processor.TableExists("Users").ShouldBeFalse();
}
示例10: CanSilentlyFail
public void CanSilentlyFail()
{
var processor = new Mock<IMigrationProcessor>();
processor.Setup(x => x.Process(It.IsAny<CreateForeignKeyExpression>())).Throws(new Exception("Error"));
processor.Setup(x => x.Process(It.IsAny<DeleteForeignKeyExpression>())).Throws(new Exception("Error"));
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor.Object) { SilentlyFail = true };
runner.Up(new TestForeignKeySilentFailure());
runner.CaughtExceptions.Count.ShouldBeGreaterThan(0);
runner.Down(new TestForeignKeySilentFailure());
runner.CaughtExceptions.Count.ShouldBeGreaterThan(0);
}
示例11: CanApplyIndexConvention
public void CanApplyIndexConvention()
{
ExecuteWithSupportedProcessors(
processor =>
{
var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);
runner.Up(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeTrue();
runner.Down(new TestIndexNamingConvention());
processor.TableExists("Users").ShouldBeFalse();
//processor.CommitTransaction();
});
}
示例12: CanApplyForeignKeyConvention
public void CanApplyForeignKeyConvention()
{
ExecuteWithSupportedProcessors(
processor =>
{
var conventions = new MigrationConventions();
var runner = new MigrationRunner(conventions, processor);
runner.Up(new TestForeignKeyNamingConvention());
processor.TableExists("Users").ShouldBeTrue();
processor.ConstraintExists("Users", "FK_Users_GroupId_Groups_GroupId").ShouldBeTrue();
runner.Down(new TestForeignKeyNamingConvention());
processor.TableExists("Users").ShouldBeFalse();
});
}
示例13: CanApplyForeignKeyConvention
public void CanApplyForeignKeyConvention()
{
ExecuteWithSupportedProcessors(
processor =>
{
var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);
runner.Up(new TestForeignKeyNamingConvention());
// This is a hack until MigrationVersionRunner and MigrationRunner are refactored and merged together
//processor.CommitTransaction();
processor.ConstraintExists( "Users", "FK_Users_GroupId_Groups_GroupId" ).ShouldBeTrue();
runner.Down( new TestForeignKeyNamingConvention() );
});
}
示例14: CanUseVersionInfo
public void CanUseVersionInfo()
{
ExecuteWithSupportedProcessors(processor =>
{
var runner = new MigrationRunner(new MigrationConventions(), processor);
//ensure table doesn't exist
if (processor.TableExists(VersionInfo.TABLE_NAME))
runner.Down(new VersionMigration());
runner.Up(new VersionMigration());
processor.TableExists(VersionInfo.TABLE_NAME).ShouldBeTrue();
runner.Down(new VersionMigration());
processor.TableExists(VersionInfo.TABLE_NAME).ShouldBeFalse();
});
}
示例15: CanRunMigration
public void CanRunMigration()
{
ExecuteWithSupportedProcessors(processor =>
{
var runner = new MigrationRunner(Assembly.GetExecutingAssembly(), _runnerContext, processor);
runner.Up(new TestCreateAndDropTableMigration());
processor.TableExists(null, "TestTable").ShouldBeTrue();
// This is a hack until MigrationVersionRunner and MigrationRunner are refactored and merged together
//processor.CommitTransaction();
runner.Down(new TestCreateAndDropTableMigration());
processor.TableExists(null, "TestTable").ShouldBeFalse();
});
}