コード例 #1
0
        public void FixtureTeardown()
        {
            // Return the database back to pre-first migration state
            var configuration = new Veil.DataAccess.Migrations.Configuration();
            var migrator = new DbMigrator(configuration);

            migrator.Update("0"); // 0 is equivalent to undoing all migrations
        }
コード例 #2
0
        public void FixtureSetup()
        {
            // Migrate the database to the most current migration
            var configuration = new Veil.DataAccess.Migrations.Configuration();
            var migrator = new DbMigrator(configuration);

            migrator.Update();
        }
コード例 #3
0
    public void FullUp_FullDown()
    {
        var configuration = new Veil.DataAccess.Migrations.Configuration();
        var migrator = new DbMigrator(configuration);

        List<string> migrations = new List<string> { "0" };
        migrations.AddRange(migrator.GetLocalMigrations());

        migrator.Update(migrations.Last());
        migrator.Update(migrations.First());
    }
コード例 #4
0
    public void RunAll()
    {
        var configuration = new Veil.DataAccess.Migrations.Configuration();
        var migrator = new DbMigrator(configuration);

        List<string> migrations = new List<string> { "0" };
        migrations.AddRange(migrator.GetLocalMigrations());

        // Ensure we are starting from pre-first migration state
        migrator.Update(migrations.First());

        // Run all the migrations. Goes up one, down one, up two, down one, up two, down one, etc.
        for (int i = 0; i < migrations.Count; i++)
        {
            migrator.Update(migrations[i]);

            if (i > 0)
            {
                migrator.Update(migrations[i - 1]);
            }
        }
    }