public override void Context()
            {
                migrator = new Migrate().Set(p =>
                {
                    p.Logger            = new ConsoleLogger();
                    p.DatabaseName      = database_name;
                    p.SqlFilesDirectory = sql_files_folder;
                    p.Silent            = true;
                });
                migrator.Run();
                ConfigurationPropertyHolder configuration_property_holder = migrator.GetConfiguration();

                ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration_property_holder);
                db.configuration                 = configuration_property_holder;
                db.server_name                   = configuration_property_holder.ServerName ?? string.Empty;
                db.database_name                 = configuration_property_holder.DatabaseName ?? string.Empty;
                db.connection_string             = configuration_property_holder.ConnectionString;
                db.admin_connection_string       = configuration_property_holder.ConnectionStringAdmin;
                db.roundhouse_schema_name        = configuration_property_holder.SchemaName;
                db.version_table_name            = configuration_property_holder.VersionTableName;
                db.scripts_run_table_name        = configuration_property_holder.ScriptsRunTableName;
                db.scripts_run_errors_table_name = configuration_property_holder.ScriptsRunErrorsTableName;
                db.command_timeout               = configuration_property_holder.CommandTimeout;
                db.admin_command_timeout         = configuration_property_holder.CommandTimeoutAdmin;
                db.restore_timeout               = configuration_property_holder.RestoreTimeout;
                db.initialize_connections(configuration_property_holder);
            }
        private void run_changes(Migrate migrator, ConfigurationPropertyHolder configuration, Assembly migrations_assembly)
        {
            var files_directory = configuration.SqlFilesDirectory;

            configuration.SqlFilesDirectory = ".";
            bool restoring_the_database = RefreshDatabaseParameters.RestoreDatabase;
            var  initial_development    = RefreshDatabaseParameters.DropDatabaseFirst;

            if (initial_development)
            {
                migrator.RunDropCreate();
            }
            else if (restoring_the_database)
            {
                configuration.Restore = true;
                migrator.RunRestore();
            }
            else
            {
                migrator.Run();
            }

            generate_database_changes(migrations_assembly);
            Console.WriteLine("NOTE: To regenerate files you need to first delete them from the file system.");

            configuration.SqlFilesDirectory = files_directory;
            configuration.Restore           = false;
            migrator.Run();
        }
Exemple #3
0
        static void Main()
        {
            Migrate.Database("database", options: new Options().UseVersionTableName("__DatabaseVersion"));

            using (var container = new WindsorContainer())
            {
                // run Windsor installers - they're in the UnitOfWork.Installers namespace
                container.Install(FromAssembly.This());

                Configure.With(new CastleWindsorContainerAdapter(container))
                .Transport(t => t.UseMsmq("uow.test"))
                .Options(o =>
                {
                    // run the potentially failing handler last to demonstrate
                    // that the uow is not committed, even though the error
                    // happes after the insert
                    o.SpecifyOrderOfHandlers()
                    .First <InsertRowsIntoDatabase>()
                    .Then <FailSometimes>();
                })
                .Start();

                using (var timer = new Timer(1000))
                {
                    timer.Elapsed += (o, ea) => SendStringToSelf(container);
                    timer.Start();

                    Console.WriteLine("Press ENTER to quit");
                    Console.ReadLine();
                }
            }
        }
Exemple #4
0
        public static void InitMigrationDbStructure(string connectionString)
        {
            Migrate migrator = new Migrate().Set(c =>
            {
                c.Logger                    = new ConsoleLogger();
                c.ConnectionString          = connectionString;
                c.SqlFilesDirectory         = MIGRATION_PATH;
                c.SprocsFolderName          = @"dbo\Stored Procedures";
                c.ViewsFolderName           = @"dbo\Views";
                c.FunctionsFolderName       = @"dbo\Functions";
                c.UpFolderName              = @"Scripts\Migrations\up";
                c.RunBeforeUpFolderName     = @"Scripts\Migrations\runbeforeup";
                c.RunFirstAfterUpFolderName = @"Scripts\Migrations\runfirstafterup";
                c.DownFolderName            = @"Scripts\Migrations\down";
                c.Restore                   = false;
                c.Silent                    = true;
                c.Baseline                  = true;
                c.WithTransaction           = true;
                c.UsingVSDBProjectScripts   = true;
            });

            var configuration = migrator.GetConfiguration();

            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration);
            migrator.Run();
        }
Exemple #5
0
        public void Dispose()
        {
            _ndbUnitTest.PerformDbOperation(DbOperationFlag.DeleteAll);
            _ndbUnitTest.Dispose();

            Migrate.Down(_connection.ConnectionString);
        }
        private static void RunRoundhouseNhibernate()
        {
            var mappingsAssembly    = Assembly.LoadFrom(_mappingsAssemblyPath);
            var conventionsAssembly = Assembly.LoadFrom(_conventionsAssemblyPath);

            var migrator = new Migrate().Set(c => {
                c.DatabaseName       = _databaseName;
                c.RepositoryPath     = _repositoryPath;
                c.SqlFilesDirectory  = _pathToSqlScripts;
                c.RestoreFromPath    = _pathToRestore;
                c.Silent             = true;
                c.RecoveryModeSimple = true;
            });


            var diffType   = _restoreDuringMaintenance ? RoundhousEFluentNHDiffingType.MaintenanceWithRestore : RoundhousEFluentNHDiffingType.Maintenance;
            var scriptName = _nameOfUpdateScript;

            if (_isThisInitialDevelopment)
            {
                scriptName = _nameOfInitialScript;
                diffType   = RoundhousEFluentNHDiffingType.InitialDevelopment;
            }

            new DifferenceWithFluentNHibernate().Run(diffType, scriptName, migrator, mappingsAssembly, conventionsAssembly);
        }
        public void Menu()
        {
            Console.WriteLine("---------------------------------");
            Console.WriteLine("Welcome to the EmpleaDO Migration Tool");
            Console.WriteLine("---------------------------------");

            Console.WriteLine("---------------------------------");
            Console.WriteLine("Where you wanna test (Transfer Data From Production to Beta)?");
            Console.WriteLine("---------------------------------");
            Console.WriteLine("1- Local");
            Console.WriteLine("2- Azure");

            string  input = Console.ReadLine();
            int     selectedOption;
            Migrate migrate = new Migrate(_config, _mapper);

            if (int.TryParse(input, out selectedOption))
            {
                switch (selectedOption)
                {
                case 1:
                    migrate.FromProductionToBeta();
                    break;

                case 2:

                    break;
                }
            }
            else
            {
                Console.WriteLine("Debe ser una opcion valida.");
            }
        }
Exemple #8
0
        public void TestMigrate()
        {
            string storageFolder = Factory.Settings["AppDataFolder"];

            if (storageFolder == null)
            {
                throw new ApplicationException("Must set AppDataFolder property in app.config");
            }
            string origFile   = storageFolder + @"\Test\\DataCache\USDJPY.Migrate.tck";
            string tempFile   = origFile + ".temp";
            string backupFile = origFile + ".back";

            File.Delete(backupFile);
            File.Delete(origFile);
            string fileName = storageFolder + @"\Test\\DataCache\USD_JPY.tck";

            if (!File.Exists(fileName))
            {
                fileName = fileName.Replace(".tck", "_Tick.tck");
            }
            File.Copy(fileName, origFile);

            string[] args = { origFile };

            Migrate migrate = new Migrate();

            migrate.Run(args);
            Assert.IsTrue(File.Exists(origFile));
            Assert.IsTrue(File.Exists(backupFile));
            Assert.IsFalse(File.Exists(tempFile));
        }
Exemple #9
0
        private static void RunRoundhouse()
        {
            var migrationsAssembly = Assembly.LoadFrom(RefreshDatabaseParameters.MigrationsAssemblyPath);

            var migrator = new Migrate().Set(c =>
            {
                c.Logger            = new roundhouse.infrastructure.logging.custom.ConsoleLogger();
                c.ConnectionString  = RefreshDatabaseParameters.Database.GetConnectionString();
                c.RepositoryPath    = RefreshDatabaseParameters.RepositoryPath;
                c.SqlFilesDirectory = RefreshDatabaseParameters.PathToSqlScripts;
                c.Restore           = false;
                c.RestoreFromPath   = RefreshDatabaseParameters.PathToRestore;
                if (!string.IsNullOrWhiteSpace(RefreshDatabaseParameters.RestoreCustomOptions))
                {
                    c.RestoreCustomOptions = RefreshDatabaseParameters.RestoreCustomOptions;
                }
                c.Silent             = true;
                c.RecoveryModeSimple = true;
                c.VersionFile        = RefreshDatabaseParameters.MigrationsAssemblyPath;
            });



            new DifferenceWithEntityFramework().Run(migrator, migrationsAssembly);
        }
Exemple #10
0
        public static MigratorOptions CreateMigrateUp(Migrate cmd, long?targetVersion = null)
        {
            var result = new MigratorOptions("migrate:up")
                         .Init(cmd);

            result.TargetVersion   = targetVersion;
            result.TransactionMode = cmd.TransactionMode;
            return(result);
        }
        public void Delete(Migrate request)
        {
            using (var writer = Response.GetChunkedWriter())
            {
                Migrate(writer, request.PreviewOnly, true, request.Version, request.ConnectionString);
            }

            Response.Close();
        }
        public void Dispose()
        {
            var roundhouseMigrate = new Migrate();

            roundhouseMigrate.Set(x => x.ConnectionString = database.ConnectionString);
            roundhouseMigrate.GetConfiguration().DoNotCreateDatabase = true;
            roundhouseMigrate.GetConfiguration().Drop            = true;
            roundhouseMigrate.GetConfiguration().WithTransaction = false;
            roundhouseMigrate.Run();
        }
        void rh(Roundhouse directive, string destinationDirectory)
        {
            var migrate = new Migrate();

            migrate.Set(cfg =>
            {
                cfg.CommandTimeout    = directive.GetCommandTimeout();
                cfg.ConnectionString  = directive.ConnectionString;
                cfg.SqlFilesDirectory = destinationDirectory;
                cfg.Silent            = true;
            }).Run();
        }
        public void Deletes(string element)
        {
            var old = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""15.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <PlaceHolder />
</Project>";

            old = old.Replace("<PlaceHolder />", element);
            var expected = @"<Project Sdk=""Microsoft.NET.Sdk"" />";

            Assert.AreEqual(expected, Migrate.ProjectFile(old, string.Empty));
        }
        public void KeepsPaketTarget()
        {
            var old = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""15.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <Import Project=""..\.paket\Paket.Restore.targets"" />
</Project>";

            var expected = @"<Project Sdk=""Microsoft.NET.Sdk"">
  <Import Project=""..\.paket\Paket.Restore.targets"" />
</Project>";

            Assert.AreEqual(expected, Migrate.ProjectFile(old, string.Empty));
        }
Exemple #16
0
        public void Setup(string data)
        {
            Migrate.Up(_connection.ConnectionString);

            _ndbUnitTest = new PostgresqlDbUnitTest(_connection.ConnectionString);
            _ndbUnitTest.ReadXmlSchema("Files/Schema.xsd");
            if (!string.IsNullOrEmpty(data))
            {
                _ndbUnitTest.ReadXml(data);
            }

            _ndbUnitTest.PerformDbOperation(DbOperationFlag.CleanInsertIdentity);
        }
        // initial database setup

        private void run_initial_database_setup(Migrate migrator, ConfigurationPropertyHolder configuration, Assembly mappings_assembly, Assembly conventions_assembly)
        {
            var files_directory = configuration.SqlFilesDirectory;

            configuration.SqlFilesDirectory = ".";

            migrator.Run();

            generate_database_schema(configuration.DatabaseName, mappings_assembly, conventions_assembly);

            configuration.SqlFilesDirectory = files_directory;
            migrator.RunDropCreate();
        }
Exemple #18
0
        public static async void UseSportsStore(this IApplicationBuilder app)
        {
            await Migrate.ExecuteContextsMigrate(app);

            await DictionarySeedData.PopulateDictionaries(app);

            await ProductSeedData.EnsurePopulated(app);

            await PermissionSeedData.PopulatePermissions(app);

            await IdentitySeedData.PopulateIdentity(app);

            await SystemParametersSeedData.PopulateParameters(app);
        }
Exemple #19
0
 public void SetMigrateFolders(Migrate migrateSettings, string schemaScriptsFolder)
 {
     migrateSettings.Set(x => x.SqlFilesDirectory = schemaScriptsFolder).Set(
         x => x.RunAfterCreateDatabaseFolderName  = RunAfterCreateDatabaseFolderName(schemaScriptsFolder))
     .Set(x => x.IndexesFolderName = IndexesFolderName(schemaScriptsFolder))
     .Set(
         x =>
         x.RunAfterOtherAnyTimeScriptsFolderName =
             RunAfterOtherAnyTimeScriptsFolderName(schemaScriptsFolder))
     .Set(x => x.SprocsFolderName    = SprocsFolderName(schemaScriptsFolder))
     .Set(x => x.FunctionsFolderName = FunctionsFolderName(schemaScriptsFolder))
     .Set(x => x.ViewsFolderName     = ViewsFolderName(schemaScriptsFolder))
     .Set(x => x.UpFolderName        = UpFolderName(schemaScriptsFolder));
 }
Exemple #20
0
        /// <summary>
        /// Initializes the database and stuff.
        /// </summary>
        public static void Plumbing()
        {
            var clientId = SettingsManager.ClientSettings.AppConfiguration.ClientId;
            var baseUrl  = String.Format("http://download{0}.inbox2.com/",
                                         String.IsNullOrEmpty(CommandLine.Current.Environment) ? String.Empty : "." + CommandLine.Current.Environment);

            Migrate.Up(typeof(ChannelConfig));
            Migrate.Up(typeof(Conversation));
            Migrate.Up(typeof(Message));
            Migrate.Up(typeof(Document));
            Migrate.Up(typeof(DocumentVersion));
            Migrate.Up(typeof(Person));
            Migrate.Up(typeof(Profile));
            Migrate.Up(typeof(UserStatus));
            Migrate.Up(typeof(UserStatusAttachment));
            Migrate.Up(typeof(QueuedCommand));
            Migrate.Up(typeof(FeedItem));

            var appVersion   = Assembly.GetExecutingAssembly().GetName().Version;
            var savedVersion = SettingsManager.ClientSettings.Version;

            Logger.Warn("Saved version {0}", LogSource.Startup, savedVersion);

            if (_isFirstRun || Environment.CommandLine.Contains("/firstrun"))
            {
                HttpServiceRequest.Post(baseUrl + "version/install",
                                        String.Format("clientId={0}&version={1}", clientId, appVersion));
            }

            if (_isFirstRun == false && appVersion > savedVersion)
            {
                Logger.Debug("Upgrade detected, performing nescessary upgrade actions", LogSource.Startup);

                // Get all upgrades
                UpgradeActionBase.Upgrades.AddRange(typeof(Startup)
                                                    .Assembly.GetTypes()
                                                    .Where(t => t.IsSubclassOf(typeof(UpgradeActionBase)))
                                                    .Select(t => (UpgradeActionBase)Activator.CreateInstance(t))
                                                    .Where(i => i.TargetVersion > savedVersion)
                                                    .OrderBy(i => i.TargetVersion));

                UpgradeActionBase.Upgrades.ForEach(i => i.Upgrade());

                HttpServiceRequest.Post(baseUrl + "version/upgrade",
                                        String.Format("clientId={0}&from={1}&to={2}", clientId, savedVersion, appVersion));
            }

            // Save current version
            SettingsManager.ClientSettings.Version = appVersion;
        }
 protected static Database get_assert_database()
 {
     var m = new Migrate().Set(p =>
         {
             p.Logger = new ConsoleLogger();
             p.DatabaseName = database_name;
             p.SqlFilesDirectory = sql_files_folder;
             p.Silent = true;
             p.DryRun = false;
         });
     ApplicationConfiguraton.set_defaults_if_properties_are_not_set(m.GetConfiguration());
     ApplicationConfiguraton.build_the_container(m.GetConfiguration());
     return Container.get_an_instance_of<Database>();
 }
Exemple #22
0
 private void SetFolderNames(Migrate roundhouseMigrate)
 {
     roundhouseMigrate
     .Set(x => x.RunAfterCreateDatabaseFolderName      = "RunAfterCreateDatabase")
     .Set(x => x.RunAfterOtherAnyTimeScriptsFolderName = "RunAfterOtherAnyTimeScripts")
     .Set(x => x.FunctionsFolderName       = "Functions")
     .Set(x => x.SprocsFolderName          = "Sprocs")
     .Set(x => x.UpFolderName              = "Up")
     .Set(x => x.IndexesFolderName         = "Indexes")
     .Set(x => x.PermissionsFolderName     = "Permissions")
     .Set(x => x.ViewsFolderName           = "Views")
     .Set(x => x.AlterDatabaseFolderName   = "AlterDatabase")
     .Set(x => x.TriggersFolderName        = "Triggers")
     .Set(x => x.RunFirstAfterUpFolderName = "RunFirstAfterUp");
 }
Exemple #23
0
        public void SetRunRestoreOptions(Migrate migrateSettings)
        {
            if (!string.IsNullOrWhiteSpace(restorePath) && !File.Exists(restorePath))
            {
                throw new FileNotFoundException($"Restore Path {restorePath}\r\ndoes not exist");
            }

            if (!string.IsNullOrWhiteSpace(restorePath))
            {
                var database = Path.GetFileNameWithoutExtension(restorePath);
                migrateSettings.Set(x => x.RestoreFromPath = restorePath)
                .Set(x => x.Restore = !string.IsNullOrWhiteSpace(restorePath))
                .Set(x => x.RestoreCustomOptions = string.Format(@", MOVE '{0}' TO '{1}\{0}.mdf', MOVE '{0}_log' TO '{1}\{0}_log.LDF'", database, @"c:\Temp"));
            }
        }
 public override void Context()
 {
     lock (server_name)
     {
         migrator = new Migrate().Set(p =>
         {
             p.ServerName        = server_name;
             p.Logger            = new ConsoleLogger();
             p.DatabaseType      = "SqlServerCE";
             p.SqlFilesDirectory = sql_files_folder;
             p.Silent            = true;
         });
         migrator.Run();
     }
 }
        public MigrationResultSet Run(string connection, string workingDirectory, string createScript, string databaseName, string server, int timeout)
        {
            var logger = new RelativityRoundHouseLogger();

            //create migration agent
            var migrationAgent = new Migrate();

            //get default round house settings
            var configuration = migrationAgent.GetConfiguration();

            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration);

            //get the action delegate settings
            var roundHouseService = new RoundHouseSettingsService
            {
                ServerName = server
            };
            var roundhouseConfiguration = roundHouseService.GetRoundHouseSettings(connection, workingDirectory, createScript);

            //register the delegate
            migrationAgent.Set(roundhouseConfiguration);
            if (!string.IsNullOrEmpty(server))
            {
                migrationAgent.Set(x => x.DatabaseName = databaseName);
            }
            migrationAgent.SetCustomLogging(logger);
            migrationAgent.Set(x => x.CommandTimeout      = timeout);
            migrationAgent.Set(x => x.CommandTimeoutAdmin = timeout);

            // Update the database
            try
            {
                // Some googling shows that roundhouse may not be threadsafe.
                // This starts a lock context to prevent multiple threads running roundhouse deployments at the same time.
                lock (obj)
                {
                    migrationAgent.Run();
                }
            }
            catch (Exception e)
            {
                //This is theoretically already logged by RoundhousE, but if something in RH breaks rather than in SQL, I want to know
                logger.Messages.Add(new LogMessage(LogSeverity.Error, e.ToString()));
                return(new MigrationResultSet(false, logger.Messages));
            }

            return(new MigrationResultSet(true, logger.Messages));
        }
Exemple #26
0
        public void Deploy(string schemaScriptsFolder, string repository = "", bool dropDatabase = false)
        {
            if (schemaScriptsFolder == string.Empty)
            {
                schemaScriptsFolder = Assembly.GetExecutingAssembly().Directory();
            }

            if (!Directory.Exists(schemaScriptsFolder))
            {
                throw new DirectoryNotFoundException(
                          string.Format(
                              "Database schema scripts folder {0}\r\ndoes not exist", schemaScriptsFolder));
            }

            var roundhouseMigrate = new Migrate();

            if (DatabaseFolderStructure != null)
            {
                DatabaseFolderStructure.SetMigrateFolders(roundhouseMigrate, schemaScriptsFolder);
            }
            if (databaseRestoreOptions != null)
            {
                databaseRestoreOptions.SetRunRestoreOptions(roundhouseMigrate);
            }

            roundhouseMigrate.Set(x => x.ConnectionString = this.ConnectionString)
            .Set(x => x.SqlFilesDirectory          = schemaScriptsFolder)
            .Set(x => x.VersionFile                = Path.Combine(schemaScriptsFolder, "_BuildInfo.txt"))
            .Set(x => x.WithTransaction            = WithTransaction)
            .Set(x => x.Silent                     = true)
            .Set(x => x.RecoveryMode               = RecoveryMode.NoChange)
            .Set(x => x.RepositoryPath             = repository)
            .Set(x => x.WarnOnOneTimeScriptChanges = WarnOnOneTimeScriptChanges)
            .Set(x => x.DisableTokenReplacement    = true)
            .Set(x => x.Drop = dropDatabase)
            .SetCustomLogging(logger);

            if (databaseRestoreOptions != null)
            {
                roundhouseMigrate.RunRestore();
            }
            else
            {
                roundhouseMigrate.Run();
            }
        }
Exemple #27
0
        public void Run()
        {
            _logger.LogInformation($"Running {typeof(App).FullName}");

            // Setup dapper
            SimpleCRUD.SetDialect(SimpleCRUD.Dialect.PostgreSQL);

            // Setup database
            Migrate.Up(_dbConfig.ConnectionString);

            // Setup commands
            Setup <CreateCategoryCommand>();
            Setup <CreatePodcastCommand>();
            Setup <DeleteCategoryCommand>();
            Setup <DeletePodcastCommand>();
            Setup <PopulateCommand>();
        }
        /// <summary>
        /// Set up your migrator and call this to generate a diff file. Known limitations - will not detect size changes or renames. In other words, destructive changes will need to be done by hand.
        /// </summary>
        /// <param name="databaseMigrator">The Migrator to use when running.</param>
        /// <param name="migrationsAssembly">This is the assembly that contains your mapping files.</param>
        public void Run(Migrate databaseMigrator, Assembly migrationsAssembly)
        {
            var configuration = databaseMigrator.GetConfiguration();

            configuration.Silent  = true;
            configuration.Restore = false;
            ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration);
            path_to_sql_scripts_up_folder = Path.Combine(configuration.SqlFilesDirectory, configuration.UpFolderName);

            databaseMigrator.Set(c =>
            {
                c.Silent      = true;
                c.VersionFile = migrationsAssembly.Location;
            }
                                 );

            run_changes(databaseMigrator, configuration, migrationsAssembly);
        }
Exemple #29
0
        protected override void main(string[] args)
        {
            if (0 == args.Length)
            {
                System.Console.WriteLine("Press 'C' to clean, any other key runs migration.");
                if (ConsoleKey.C == System.Console.ReadKey().Key)
                {
                    args = new string[] { "clean" }
                }
                ;
            }
            Migrate migrate = new Migrate(new ContactsMigration.CConsole());

            migrate.Run(Program.DefaultConnectionString, args.Length > 0 ? args[0] : null);
            System.Console.WriteLine("Press any key...");
            System.Console.ReadKey();
        }
    }
        public void DeletesChoose()
        {
            var old = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""15.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <Choose>
    <When Condition=""('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"">
      <ItemGroup>
        <Reference Include=""Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"" />
      </ItemGroup>
    </When>
    <Otherwise />
  </Choose>
</Project>";

            var expected = @"<Project Sdk=""Microsoft.NET.Sdk"" />";

            Assert.AreEqual(expected, Migrate.ProjectFile(old, string.Empty));
        }
        public static void Run(string connectionString, string scriptsLocation, string environmentName, bool dropDatabase, bool useSimpleRecoveryMode, string repositoryPath, string versionFile, string versionXPath, int commmandTimeout, int commandTimeoutAdmin, bool restore, string restorePath, int restoreTimeout, string restoreCustomOptions, string functionsFolderName, string sprocsFolderName, string viewsFolderName, string upFolderName, string versionTable, string scriptsRunTable, string scriptsRunErrorTable, bool?warnOnOneTimeScriptChanges, string outputPath)
        {
            var migrate = new Migrate();

            migrate
            .Set(p =>
            {
                p.Logger = new roundhouse.infrastructure.logging.custom.Log4NetLogger(Logging.WellKnown.DatabaseChanges);

                p.ConnectionString  = connectionString;
                p.SqlFilesDirectory = scriptsLocation;
                p.EnvironmentName   = environmentName;
                p.Drop = dropDatabase;
                p.RecoveryModeSimple   = useSimpleRecoveryMode;
                p.Restore              = restore;
                p.RestoreFromPath      = restorePath;
                p.RestoreTimeout       = restoreTimeout;
                p.RestoreCustomOptions = restoreCustomOptions;
                p.RepositoryPath       = repositoryPath;
                p.VersionFile          = versionFile;
                p.VersionXPath         = versionXPath;
                p.CommandTimeout       = commmandTimeout;
                p.CommandTimeoutAdmin  = commandTimeoutAdmin;

                p.FunctionsFolderName = functionsFolderName;
                p.SprocsFolderName    = sprocsFolderName;
                p.ViewsFolderName     = viewsFolderName;
                p.UpFolderName        = upFolderName;

                p.VersionTableName          = versionTable;
                p.ScriptsRunTableName       = scriptsRunTable;
                p.ScriptsRunErrorsTableName = scriptsRunErrorTable;
                p.OutputPath = outputPath;

                if (warnOnOneTimeScriptChanges.HasValue)
                {
                    p.WarnOnOneTimeScriptChanges = warnOnOneTimeScriptChanges.Value;
                }

                p.Silent = true;
            })
            .Run();
        }
 public static void Main()
 {
     // Make an instance of the player, and let it play the gaqme.
     Migrate migrate = new Migrate();
     migrate.Run();
 }
 private void AssertColumn(Boycott.Helpers.DbColumn column, string name, bool increment, string defaultValue, bool pk, int limit,
     bool nullable, int precision, int scale, Migrate.DbType type)
 {
     Assert.AreEqual(column.Name, name, name);
     Assert.AreEqual(column.AutoIncrement, increment, "{0} - auto_increment", name);
     Assert.AreEqual(column.DefaultValue, defaultValue, "{0} - default", name);
     Assert.AreEqual(column.IsPrimaryKey, pk, "{0} - pk", name);
     Assert.AreEqual(column.Limit, limit, "{0} - limit", name);
     Assert.AreEqual(column.Nullable, nullable, "{0} - nullable", name);
     Assert.AreEqual(column.Precision, precision, "{0} - precision", name);
     Assert.AreEqual(column.Scale, scale, "{0} - scale", name);
     Assert.AreEqual(column.Type, type, "{0} - type", name);
 }