Ejemplo n.º 1
0
        static int Main(string[] args)
        {
            try
            {
                Paths.InitializeRhetosServerRootPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ".."));

                string connectionString = SqlUtility.ConnectionString;
                Console.WriteLine("SQL connection string: " + SqlUtility.MaskPassword(connectionString));
                var sqlExecuter = GetSqlExecuterImplementation(connectionString);

                var databaseCleaner = new DatabaseCleaner(new ConsoleLogProvider(), sqlExecuter);
                databaseCleaner.DeleteAllMigrationData();
                return 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                DeploymentUtility.WriteError(ex.Message);
                Console.WriteLine("Details:");
                Console.WriteLine(ex);
                if (Environment.UserInteractive)
                    Thread.Sleep(3000);
                return 1;
            }
        }
Ejemplo n.º 2
0
 public DatabaseDeployment(
     ILogProvider logProvider,
     ISqlExecuter sqlExecuter,
     DatabaseCleaner databaseCleaner,
     DataMigrationScriptsExecuter dataMigrationScriptsExecuter,
     IDatabaseGenerator databaseGenerator,
     IConceptDataMigrationExecuter dataMigrationFromCodeExecuter)
 {
     _logger          = logProvider.GetLogger(GetType().Name);
     _sqlExecuter     = sqlExecuter;
     _databaseCleaner = databaseCleaner;
     _dataMigrationScriptsExecuter  = dataMigrationScriptsExecuter;
     _databaseGenerator             = databaseGenerator;
     _dataMigrationFromCodeExecuter = dataMigrationFromCodeExecuter;
 }
Ejemplo n.º 3
0
 public ApplicationGenerator(
     ILogProvider logProvider,
     ISqlExecuter sqlExecuter,
     IDslModel dslModel,
     IDomGenerator domGenerator,
     IPluginsContainer<IGenerator> generatorsContainer,
     DatabaseCleaner databaseCleaner,
     DataMigration dataMigration,
     IDatabaseGenerator databaseGenerator,
     IDslScriptsProvider dslScriptsLoader)
 {
     _deployPackagesLogger = logProvider.GetLogger("DeployPackages");
     _performanceLogger = logProvider.GetLogger("Performance");
     _sqlExecuter = sqlExecuter;
     _dslModel = dslModel;
     _domGenerator = domGenerator;
     _generatorsContainer = generatorsContainer;
     _databaseCleaner = databaseCleaner;
     _dataMigration = dataMigration;
     _databaseGenerator = databaseGenerator;
     _dslScriptsLoader = dslScriptsLoader;
 }
Ejemplo n.º 4
0
 public ApplicationGenerator(
     ILogProvider logProvider,
     ISqlExecuter sqlExecuter,
     IDslModel dslModel,
     IDomGenerator domGenerator,
     IPluginsContainer <IGenerator> generatorsContainer,
     DatabaseCleaner databaseCleaner,
     DataMigration dataMigration,
     IDatabaseGenerator databaseGenerator,
     IDslScriptsProvider dslScriptsLoader)
 {
     _deployPackagesLogger = logProvider.GetLogger("DeployPackages");
     _performanceLogger    = logProvider.GetLogger("Performance");
     _sqlExecuter          = sqlExecuter;
     _dslModel             = dslModel;
     _domGenerator         = domGenerator;
     _generatorsContainer  = generatorsContainer;
     _databaseCleaner      = databaseCleaner;
     _dataMigration        = dataMigration;
     _databaseGenerator    = databaseGenerator;
     _dslScriptsLoader     = dslScriptsLoader;
 }
Ejemplo n.º 5
0
        static int Main(string[] args)
        {
            try
            {
                string connectionString = SqlUtility.ConnectionString;
                Console.WriteLine("SQL connection string: " + SqlUtility.MaskPassword(connectionString));
                var sqlExecuter = GetSqlExecuterImplementation(connectionString);

                var databaseCleaner = new DatabaseCleaner(new ConsoleLogProvider(), sqlExecuter);
                databaseCleaner.DeleteAllMigrationData();
                return 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                DeploymentUtility.WriteError(ex.Message);
                Console.WriteLine("Details:");
                Console.WriteLine(ex);
                Thread.Sleep(3000);
                return 1;
            }
        }
Ejemplo n.º 6
0
        public void TestCleanupOldData(string description,
            string oldTables, string oldSchemas,
            string expectedDeletedTables, string expectedDeletedSchemas)
        {
            var mockSqlExecuter = new MockSqlExecuter("", oldTables, oldSchemas);
            var databaseCleaner = new DatabaseCleaner(new ConsoleLogProvider(), mockSqlExecuter);
            Console.WriteLine("Report: " + databaseCleaner.DeleteAllMigrationData());

            Assert.AreEqual("", TestUtility.DumpSorted(mockSqlExecuter.DroppedColumns), description + ": Deleted columns.");
            Assert.AreEqual(expectedDeletedTables, TestUtility.DumpSorted(mockSqlExecuter.DroppedTables), description + ": Deleted tables.");
            Assert.AreEqual(expectedDeletedSchemas, TestUtility.DumpSorted(mockSqlExecuter.DroppedSchemas), description + ": Deleted schemas.");
        }
Ejemplo n.º 7
0
        public void TestCleanupRedundantOldData(string description,
            string oldColumns, string oldTables, string oldSchemas,
            string expectedDeletedColumns, string expectedDeletedTables, string expectedDeletedSchemas)
        {
            var mockSqlExecuter = new MockSqlExecuter(oldColumns, oldTables, oldSchemas);
            var databaseCleaner = new DatabaseCleaner(new ConsoleLogProvider(), mockSqlExecuter);
            databaseCleaner.RemoveRedundantMigrationColumns();

            Assert.AreEqual(expectedDeletedColumns, TestUtility.DumpSorted(mockSqlExecuter.DroppedColumns), description + ": Deleted columns.");
            Assert.AreEqual(expectedDeletedTables, TestUtility.DumpSorted(mockSqlExecuter.DroppedTables), description + ": Deleted tables.");
            Assert.AreEqual(expectedDeletedSchemas, TestUtility.DumpSorted(mockSqlExecuter.DroppedSchemas), description + ": Deleted schemas.");
        }