Example #1
0
 private static void Migrate()
 {
     IConfigurationLoader configurationLoader = new DefaultConfigurationLoader();
     ICmsConfiguration cmsConfiguration = configurationLoader.LoadCmsConfiguration();
     IVersionChecker versionChecker = new VersionCheckerStub();
     DefaultMigrationRunner runner = new DefaultMigrationRunner(new DefaultAssemblyLoader(), cmsConfiguration, versionChecker);
     runner.MigrateStructure(descriptors);
 }
Example #2
0
        private static void Migrate(bool up)
        {
            if (up)
            {
                descriptors = descriptors.OrderByDescending(f => f.Order).ToList();
            }
            else
            {
                descriptors = descriptors.OrderBy(f => f.Order).ToList();
            }

            DefaultMigrationRunner runner = new DefaultMigrationRunner(new DefaultAssemblyLoader());

            foreach (var descriptor in descriptors)
            {
                runner.Migrate(descriptor, up);
            }
        }
Example #3
0
        /// <summary>
        /// Updates database.
        /// </summary>
        /// <param name="up">if set to <c>true</c> [up].</param>
        private void MigrateDatabase(bool up)
        {
            try
            {
                var descriptors = modulesRegistration.GetModules().Select(m => m.ModuleDescriptor).ToList();

                descriptors = up
                    ? descriptors.OrderByDescending(f => f.Order).ToList()
                    : descriptors.OrderBy(f => f.Order).ToList();

                DefaultMigrationRunner runner = new DefaultMigrationRunner(new DefaultAssemblyLoader());

                foreach (var descriptor in descriptors)
                {
                    runner.Migrate(descriptor, up);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }