Ejemplo n.º 1
0
        private static Versioning.Version GetFirstVersionInVersionsTable(Database database)
        {
            const string LAST_VERSION_COMMAND = "Select top 1 VersionNumber from Version order by Date desc";
            string       lastVersion          = database.Database.SqlQuery <string>(LAST_VERSION_COMMAND).FirstOrDefault();
            var          parser = new Versioning.JustVersionParser();

            return(parser.Parse(lastVersion));
        }
Ejemplo n.º 2
0
        internal static void UpgradeDatabaseVersion()
        {
            string connectionString           = settings.ConnectionString;
            string databaseMasterPassword     = settings.DatabaseMasterPassword;
            DatabaseValidationResult dbResult = ValidateDatabaseConnection(connectionString, databaseMasterPassword);

            string migrationsRoot = FileLocations.SqlMigrations;

            if (Directory.Exists(migrationsRoot))
            {
                var parser = new Versioning.JustVersionParser();
                var list   = SqlScriptRunner.ScriptRunner.ResolveScriptsFromPathAndVersion(migrationsRoot, "*.sql", true,
                                                                                           migrationsRoot, dbResult.CurrentVersion,
                                                                                           Versioning.Version.Max, parser);

                // commit the database upgrade in next version
            }
        }
        internal static void UpgradeDatabaseVersion()
        {
            string connectionString = settings.ConnectionString;
            string databaseMasterPassword = settings.DatabaseMasterPassword;
            DatabaseValidationResult dbResult = ValidateDatabaseConnection(connectionString, databaseMasterPassword);

            string migrationsRoot = FileLocations.SqlMigrations;
            if (Directory.Exists(migrationsRoot))
            {
                var parser = new Versioning.JustVersionParser();
                var list = SqlScriptRunner.ScriptRunner.ResolveScriptsFromPathAndVersion(migrationsRoot, "*.sql", true,
                                                                                         migrationsRoot, dbResult.CurrentVersion,
                                                                                         Versioning.Version.Max, parser);

                // commit the database upgrade in next version
            }
        }
 private static Versioning.Version GetFirstVersionInVersionsTable(Database database)
 {
     const string LAST_VERSION_COMMAND = "Select top 1 VersionNumber from Version order by Date desc";
     string lastVersion = database.Database.SqlQuery<string>(LAST_VERSION_COMMAND).FirstOrDefault();
     var parser = new Versioning.JustVersionParser();
     return parser.Parse(lastVersion);
 }