Example #1
0
        private bool DoesUmbracoRequireUpgrade(IUmbracoDatabase database)
        {
            var upgrader      = new Upgrader(new UmbracoPlan());
            var stateValueKey = upgrader.StateValueKey;

            CurrentMigrationState = KeyValueService.GetValue(database, stateValueKey);
            FinalMigrationState   = upgrader.Plan.FinalState;

            _logger.Debug <RuntimeState>("Final upgrade state is {FinalMigrationState}, database contains {DatabaseState}", FinalMigrationState, CurrentMigrationState ?? "<null>");

            return(CurrentMigrationState != FinalMigrationState);
        }
Example #2
0
        protected virtual bool EnsureUmbracoUpgradeState(IUmbracoDatabaseFactory databaseFactory, ILogger logger)
        {
            var upgrader      = new Upgrader(new UmbracoPlan());
            var stateValueKey = upgrader.StateValueKey;

            // no scope, no service - just directly accessing the database
            using (var database = databaseFactory.CreateDatabase())
            {
                CurrentMigrationState = KeyValueService.GetValue(database, stateValueKey);
                FinalMigrationState   = upgrader.Plan.FinalState;
            }

            logger.Debug <RuntimeState>("Final upgrade state is {FinalMigrationState}, database contains {DatabaseState}", CurrentMigrationState, FinalMigrationState ?? "<null>");

            return(CurrentMigrationState == FinalMigrationState);
        }