Exemplo n.º 1
0
        private void UpdateSelf()
        {
            var migrator = new SchemaMigrationExecutor(_runner, GetMigratorTasks(), SchemaName);

            using (var t = _db.BeginTransaction())
            {
                if (!_db.DatabaseTools().TableExists(TableName))
                {
                    migrator.InstallSchema();
                    AppendVersion(SchemaName, migrator.LatestVersionAvailable);
                }
                else
                {
                    var latest = GetInstalledVersion(SchemaName);
                    if (latest.IsNullOrEmpty())
                    {
                        migrator.InstallSchema();
                        AppendVersion(SchemaName, migrator.LatestVersionAvailable);
                    }
                    else
                    {
                        if (latest != migrator.LatestVersionAvailable)
                        {
                            migrator.MigrateToLatestFrom(latest);
                            AppendVersion(SchemaName, migrator.LatestVersionAvailable);
                        }
                    }
                }

                t.Commit();
            }
        }
Exemplo n.º 2
0
        private void UpdateSelf()
        {
            var migrator = new SchemaMigrationExecutor(_runner, GetMigratorTasks(), SchemaName);

            using (var t = _db.BeginTransaction())
            {
                if (!_db.DatabaseTools.TableExists(TableName))
                {
                    migrator.InstallSchema();
                    AppendVersion(SchemaName,migrator.LatestVersionAvailable);
                }
                else
                {
                    var latest = GetInstalledVersion(SchemaName);
                    if (latest.IsNullOrEmpty())
                    {
                        migrator.InstallSchema();
                        AppendVersion(SchemaName, migrator.LatestVersionAvailable);
                    }
                    else
                    {
                        if (latest != migrator.LatestVersionAvailable)
                        {
                            migrator.MigrateToLatestFrom(latest);
                            AppendVersion(SchemaName, migrator.LatestVersionAvailable);
                        }
                    }
                }

                t.Commit();
            }
        }
Exemplo n.º 3
0
 public void upgrade_from_100_to_102()
 {
     _schema.MigrateToLatestFrom("1.0.0");
     Assert.Equal("12", _sb.ToString());
 }