示例#1
0
        public void RunMigration()
        {
            if (!File.Exists(DbFile))
                System.Data.SQLite.SQLiteConnection.CreateFile(DbFile);

            //run migration
            using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
            {
                var conventions = new MigrationConventions();
                connection.Open();
                var processor = new FluentMigrator.Runner.Processors.Sqlite.SqliteProcessor(connection, new SqliteGenerator());
                var runner = new MigrationVersionRunner(conventions, processor, new MigrationLoader(conventions), typeof(SparkExampleWeb.Models.User));

                //upgrade to latest
                runner.UpgradeToLatest(false);
            }
        }
示例#2
0
        static void MigrateDatabase()
        {
            //make sure the sqlite db file exists
            if (!File.Exists(DbFile))
                System.Data.SQLite.SQLiteConnection.CreateFile(DbFile);

            //run migration
            using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
            {
                var conventions = new MigrationConventions();
                connection.Open();
                var processor = new FluentMigrator.Runner.Processors.Sqlite.SqliteProcessor(connection, new SqliteGenerator());
                var runner = new MigrationVersionRunner(conventions, processor, new MigrationLoader(conventions));

                //upgrade to latest
                runner.UpgradeToLatest(false);
            }
        }