public static void MigrateToLatest(string connectionString)
 {
     // var announcer = new NullAnnouncer();
     var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
     var assembly = Assembly.GetExecutingAssembly();
     
     var migrationContext = new RunnerContext(announcer)
     {
         Namespace = typeof(MigrationsRunner).Namespace + ".Migrations"
     };
     
     var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 };
     var factory = new FluentMigrator.Runner.Processors.SQLite.SQLiteProcessorFactory();
     using (var processor = factory.Create(connectionString, announcer, options))
     {
         var runner = new FluentMigrator.Runner.MigrationRunner(assembly, migrationContext, processor);
         runner.MigrateUp(true);
     }
 }
Esempio n. 2
0
        public void Initialize()
        {
            var announcer = new TextWriterAnnouncer(s => FileLogger.Debug(BasePage.LoggerName, s));
            var assembly  = Assembly.Load("AmministrazioneTrasparente.SQLite");

            var migrationContext = new RunnerContext(announcer)
            {
                Namespace = MIGRATION_NAMESPACE
            };

            var options = new MigrationOptions {
                PreviewOnly = false, Timeout = 60
            };
            var factory = new FluentMigrator.Runner.Processors.SQLite.SQLiteProcessorFactory();

            using (var processor = factory.Create(this._connection, announcer, options))
            {
                var runner = new MigrationRunner(assembly, migrationContext, processor);
                runner.MigrateUp(true);
            }
        }
Esempio n. 3
0
        public static void MigrateToLatest(string connectionString)
        {
            // var announcer = new NullAnnouncer();
            var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
            var assembly  = Assembly.GetExecutingAssembly();

            var migrationContext = new RunnerContext(announcer)
            {
                Namespace = typeof(MigrationsRunner).Namespace + ".Migrations"
            };

            var options = new MigrationOptions {
                PreviewOnly = false, Timeout = 60
            };
            var factory = new FluentMigrator.Runner.Processors.SQLite.SQLiteProcessorFactory();

            using (var processor = factory.Create(connectionString, announcer, options))
            {
                var runner = new FluentMigrator.Runner.MigrationRunner(assembly, migrationContext, processor);
                runner.MigrateUp(true);
            }
        }
        public void Execute()
        {
            var folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            Announcer announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));

            IRunnerContext migrationContext = new RunnerContext(announcer);

            var assembly = DatabaseAdapter.GetType().Assembly;

            var options = new ProcessorOptions
            {
                PreviewOnly = false,
                Timeout     = TimeSpan.FromHours(1)
            };

            var factory = new FluentMigrator.Runner.Processors.SQLite.SQLiteProcessorFactory();

            var processor = factory.Create(ConnectionString, announcer, options);
            var runner    = new MigrationRunner(assembly, migrationContext, processor);

            runner.MigrateUp();
        }
        public void Migrate(Action<IMigrationRunner> runnerAction)
        {
            var options = new MigrationOptions { PreviewOnly = false, Timeout = 0 };
            var factory = new FluentMigrator.Runner.Processors.SQLite.SQLiteProcessorFactory();
            var assembly = Assembly.GetExecutingAssembly();

            //using (var announcer = new NullAnnouncer())
            var announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
            var migrationContext = new RunnerContext(announcer)
            {
#if DEBUG
                // will create testdata
                Profile = "development"
#endif
            };

            using (var processor = factory.Create(connectionString, announcer, options))
            {
                var runner = new MigrationRunner(assembly, migrationContext, processor);
                runner.MigrateDown(0);
                runner.MigrateUp(true);
            }
        }