Example #1
0
        static void Main(string[] args)
        {
            var overrideConfig = new Dictionary <string, string>();

            //{
            //    { "Logging:Migration:ConsoleEnabled", "true" },
            //    { "Logging:Migration:File", "Program.sql" },
            //};

            foreach (var pair in new ConfigurationBuilder().AddJsonFile("appsettings.json").Build().AsEnumerable())
            {
                if (overrideConfig.ContainsKey(pair.Key))
                {
                    overrideConfig[pair.Key] = pair.Value;
                }
                else
                {
                    overrideConfig.Add(pair.Key, pair.Value);
                }
            }

            var logFile = new ConfigurationBuilder().AddInMemoryCollection(overrideConfig).Build().GetMigrationLogFile();

            if (logFile.IsNotEmpty() && File.Exists(logFile))
            {
                File.Delete(logFile);
            }

            MigrationExecutor.MigrateUp(BaseConfig.DatabaseSelectionFromEnvironment(), overrideConfig, true);
        }
Example #2
0
 static void Main(string[] args)
 {
     MigrationExecutor.MigrateUp(BaseConfig.DatabaseSelectionFromEnvironment());
 }