Installs schema_evolution_manager. Automatically upgrades schema_evolution_manager.
324242
def bootstrap!
      scripts = Scripts.new(self, Scripts::BOOTSTRAP_SCRIPTS)
      dir = File.join(Library.base_dir, "scripts")
      scripts.each_pending(dir) do |filename, path|
        psql_file(filename, path)
        scripts.record_as_run!(filename)
      end
    end
1222132
public function upgrade()
    {
        $this->upgradeDatabase();

        // now we refresh all blocks
        $manager = new Manager($this->app);
        $items = $manager->driver('block_type')->getItems($this->getPackageEntity());
        foreach ($items as $item) {
            $item->refresh();
        }

        Localization::clearCache();
    }
111875
def create_extension(name,
                     if_not_exists=None,
                     schema=None,
                     ext_version=None,
                     from_version=None,
                     user=None,
                     host=None,
                     port=None,
                     maintenance_db=None,
                     password=None,
                     runas=None):
    '''
    

    '''
    if if_not_exists is None:
        if_not_exists = True
    mtdata = create_metadata(name,
                             ext_version=ext_version,
                             schema=schema,
                             user=user,
                             host=host,
                             port=port,
                             maintenance_db=maintenance_db,
                             password=password,
                             runas=runas)
    installed = _EXTENSION_NOT_INSTALLED not in mtdata
    installable = is_available_extension(name,
                                         user=user,
                                         host=host,
                                         port=port,
                                         maintenance_db=maintenance_db,
                                         password=password,
                                         runas=runas)
    if installable:
        if not installed:
            args = ['CREATE EXTENSION']
            if if_not_exists:
                args.append('IF NOT EXISTS')
            args.append('"{0}"'.format(name))
            sargs = []
            if schema:
                sargs.append('SCHEMA "{0}"'.format(schema))
            if ext_version:
                sargs.append('VERSION {0}'.format(ext_version))
            if from_version:
                sargs.append('FROM {0}'.format(from_version))
            if sargs:
                args.append('WITH')
                args.extend(sargs)
            args.append(';')
            cmd = ' '.join(args).strip()
        else:
            args = []
            if schema and _EXTENSION_TO_MOVE in mtdata:
                args.append('ALTER EXTENSION "{0}" SET SCHEMA "{1}";'.format(
                    name, schema))
            if ext_version and _EXTENSION_TO_UPGRADE in mtdata:
                args.append('ALTER EXTENSION "{0}" UPDATE TO {1};'.format(
                    name, ext_version))
            cmd = ' '.join(args).strip()
        if cmd:
            _psql_prepare_and_run(
                ['-c', cmd],
                runas=runas, host=host, user=user, port=port,
                maintenance_db=maintenance_db, password=password)
    mtdata = create_metadata(name,
                             ext_version=ext_version,
                             schema=schema,
                             user=user,
                             host=host,
                             port=port,
                             maintenance_db=maintenance_db,
                             password=password,
                             runas=runas)
    ret = True
    for i in _EXTENSION_FLAGS:
        if (i in mtdata) and (i != _EXTENSION_INSTALLED):
            ret = False
    if not ret:
        log.info('Failed to create ext: %s', name)
    return ret
1018413
public function up()
	{
        // Add column "active" if NOT exist
        if (!Schema::hasColumn('pricelists', 'active')) {
            Schema::table('pricelists', function(Blueprint $table)
            {
                $table->boolean('active')->default(true);
            });
        }
	}
1328303
public final static function updateSchemaModel()
    {
        $model = new static();

        if (MbMigration::schema()->hasTable($model->getTable())) {
            MbMigration::schema()->table($model->getTable(), function (Blueprint $table) use ($model) {
                $table->engine = 'InnoDB';
                $model->updateSchema($table);
            });
        } else {
            throw new \Exception("Schema {$model->getTable()} was not found");
        }
    }
1366222
def upgrade():
    """"""
    op.create_table(
        'pidstore_pid',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('pid_type', sa.String(length=6), nullable=False),
        sa.Column('pid_value', sa.String(length=255), nullable=False),
        sa.Column('pid_provider', sa.String(length=8), nullable=True),
        sa.Column('status', sa.CHAR(1), nullable=False),
        sa.Column('object_type', sa.String(length=3), nullable=True),
        sa.Column(
            'object_uuid',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=True
        ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        'idx_object', 'pidstore_pid', ['object_type', 'object_uuid'],
        unique=False
    )
    op.create_index('idx_status', 'pidstore_pid', ['status'], unique=False)
    op.create_index(
        'uidx_type_pid', 'pidstore_pid', ['pid_type', 'pid_value'],
        unique=True
    )
    op.create_table(
        'pidstore_recid',
        sa.Column('recid', sa.BigInteger(), nullable=False),
        sa.PrimaryKeyConstraint('recid')
    )
    op.create_table(
        'pidstore_redirect',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column(
            'id',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=False
        ),
        sa.Column('pid_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['pid_id'],
            [u'pidstore_pid.id'],
            onupdate='CASCADE',
            ondelete='RESTRICT'
        ),
        sa.PrimaryKeyConstraint('id')
    )
1316078
def upgradeSystemOid(store):
    
    store.transact(
        _upgradeTableOid, store, 'axiom_types',
        lambda: store.executeSchemaSQL(CREATE_TYPES))
    store.transact(
        _upgradeTableOid, store, 'axiom_objects',
        lambda: store.executeSchemaSQL(CREATE_OBJECTS),
        lambda: store.executeSchemaSQL(CREATE_OBJECTS_IDX))
61610
def upgrade():
    """"""
    def json_column(name, **kwargs):
        """Return JSON column."""
        return sa.Column(
            name,
            sqlalchemy_utils.types.JSONType().with_variant(
                postgresql.JSON(none_as_null=True), 'postgresql',
            ),
            **kwargs
        )

    op.create_table(
        'webhooks_events',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column(
            'id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
        sa.Column('receiver_id', sa.String(length=255), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        json_column('payload', nullable=True),
        json_column('payload_headers', nullable=True),
        json_column('response', nullable=True),
        json_column('response_headers', nullable=True),
        sa.Column('response_code', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['user_id'], [u'accounts_user.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        op.f('ix_webhooks_events_receiver_id'),
        'webhooks_events',
        ['receiver_id'],
        unique=False
    )
17835
def init(self, conn):
        
        base = self.read_scripts()[0]['fname']
        logging.info('Creating the initial schema from %s',  base)
        apply_sql_script(conn, os.path.join(self.upgrade_dir, base))
        self.install_versioning(conn)
412139
public function install()
    {
        parent::install();
        $this->installXml();
        $this->registerServiceProvider();
        $this->configureSourceLocale();
        $this->refreshLatestPackageVersions();
    }
5042
public function refreshEntities()
    {

        $metadatas = $this->clearCacheAndProxies();

        // Finally, we update the schema
        $tool = new SchemaTool($this->entityManager);
        $tool->updateSchema($metadatas, true);
    }
343458
def upgrade():
    """"""
    op.create_table(
        'pidrelations_pidrelation',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('parent_id', sa.Integer(), nullable=False),
        sa.Column('child_id', sa.Integer(), nullable=False),
        sa.Column('relation_type', sa.SmallInteger(), nullable=False),
        sa.Column('index', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['child_id'], ['pidstore_pid.id'],
            name=op.f('fk_pidrelations_pidrelation_child_id_pidstore_pid'),
            onupdate='CASCADE', ondelete='CASCADE'
        ),
        sa.ForeignKeyConstraint(
            ['parent_id'], ['pidstore_pid.id'],
            name=op.f('fk_pidrelations_pidrelation_parent_id_pidstore_pid'),
            onupdate='CASCADE', ondelete='CASCADE'),
        sa.PrimaryKeyConstraint(
            'parent_id', 'child_id', name=op.f('pk_pidrelations_pidrelation')
        )
    )
93634
final public function updateSchema()
    {
        if (Configuration::DATA_MODE_WIPE === $mode = $this->configuration->getDataMode()) {
            $this->wipeData();
        }

        if (Configuration::SCHEMA_MODE_NONE !== $mode = $this->configuration->getSchemaMode()) {
        }
    }
1017032
def init_app(self, app):
        """"""
        app.cli.add_command(upgrader_cmd)
        app.extensions['invenio-upgrader'] = self
980005
def upgrade():
    """"""
    op.create_table(
        'transaction',
        sa.Column('issued_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.BigInteger(), nullable=False),
        sa.Column('remote_addr', sa.String(length=50), nullable=True),
    )
    op.create_primary_key('pk_transaction', 'transaction', ['id'])
    if op._proxy.migration_context.dialect.supports_sequences:
        op.execute(CreateSequence(Sequence('transaction_id_seq')))
523483
public function up()
    {
        //legacy app clean up
        dbexec('DELETE FROM `#__migrator_versions` WHERE component = "opensocial"');

        dbexec('ALTER TABLE `#__nodes` CHANGE `meta` `meta` text DEFAULT NULL');
        dbexec('ALTER TABLE `#__edges` CHANGE `meta` `meta` text DEFAULT NULL');
        dbexec('ALTER TABLE `#__components` CHANGE `params` `meta` text DEFAULT NULL');
        dbexec('ALTER TABLE `#__components` DROP COLUMN `link`');
        dbexec('ALTER TABLE `#__components` DROP COLUMN `menuid`');
        dbexec('ALTER TABLE `#__components` DROP COLUMN `admin_menu_link`');
        dbexec('ALTER TABLE `#__components` DROP COLUMN `admin_menu_alt`');
        dbexec('ALTER TABLE `#__components` DROP COLUMN `admin_menu_img`');

        //deleting legacy data
        dbexec('DELETE FROM `#__components` WHERE `option` IN ("com_config","com_cpanel","com_plugins","com_templates","com_components", "com_languages")');

        $this->_updateMeta('components');

        dbexec('UPDATE `#__components` SET meta = REPLACE(meta, \'"allowUserRegistration":\', \'"allow_registration":\') WHERE `option` = \'com_people\'');

        //legacy data clean up
        dbexec('DELETE FROM `#__plugins` WHERE `element` = "invite" ');
        dbexec('ALTER TABLE `#__plugins` DROP COLUMN `access`');
        dbexec('ALTER TABLE `#__plugins` DROP COLUMN `client_id`');
        dbexec('ALTER TABLE `#__plugins` DROP COLUMN `checked_out`');
        dbexec('ALTER TABLE `#__plugins` DROP COLUMN `checked_out_time`');

        $this->_updateMeta('plugins');

        dbexec('DROP TABLE IF EXISTS `#__templates_menu`');
        dbexec('DROP TABLE IF EXISTS `#__session`');
        dbexec('DROP TABLE IF EXISTS `#__sessions`');

        $query = "CREATE TABLE `#__sessions` ("
        ."`id` SERIAL,"
        ."`session_id` char(64) NOT NULL,"
        ."`node_id` bigint(11) NOT NULL DEFAULT 0,"
        ."`username` varchar(255) DEFAULT NULL,"
        ."`usertype` varchar(255),"
        ."`time` INT(11) DEFAULT 0,"
        ."`guest` tinyint(2) DEFAULT '1',"
        ."`meta` longtext,"
        ."PRIMARY KEY (`id`),"
        ."KEY `whosonline` (`guest`,`usertype`,`username`),"
        ."UNIQUE KEY `session_id` (`session_id`),"
        ."KEY `node_id` (`node_id`),"
        ."KEY `username` (`username`)"
        .") ENGINE=InnoDB CHARACTER SET=utf8";
        dbexec($query);

        //for people the alias is the same as username
        dbexec("UPDATE `#__nodes` SET alias = person_username WHERE type LIKE '%com:people.domain.entity.person' ");

        dbexec('DROP TABLE IF EXISTS `#__people_people`');

        $query = "CREATE TABLE `#__people_people` ("
        ."`people_person_id` SERIAL,"
        ."`node_id` BIGINT UNSIGNED NOT NULL,"
        ."`userid` INT(11) DEFAULT NULL,"
        ."`email` varchar(255) DEFAULT NULL,"
        ."`username` varchar(255) DEFAULT NULL,"
        ."`password` varchar(255) DEFAULT NULL,"
        ."`usertype` varchar(50) DEFAULT NULL,"
        ."`gender` varchar(50) DEFAULT NULL,"
        ."`given_name` varchar(255) DEFAULT NULL,"
        ."`family_name` varchar(255) DEFAULT NULL,"
        ."`network_presence` tinyint(3) NOT NULL DEFAULT 0,"
        ."`last_visit_date` datetime DEFAULT NULL,"
        ."`time_zone` int(11) DEFAULT NULL,"
        ."`language` varchar(100) DEFAULT NULL,"
        ."`activation_code` varchar(255) DEFAULT NULL,"
        ."PRIMARY KEY (`people_person_id`),"
        ."KEY `usertype` (`usertype`),"
        ."UNIQUE KEY `username` (`username`),"
        ."UNIQUE KEY `email` (`email`),"
        ."UNIQUE KEY `node_id` (`node_id`),"
        ."KEY `last_visit_date` (`last_visit_date`)"
        .") ENGINE=InnoDB CHARACTER SET=utf8";
        dbexec($query);

        $query = "INSERT INTO `#__people_people` ("
        ."`node_id`,`userid`,`username`,`usertype`,`gender`,"
        ."`email`,`given_name`,`family_name`,"
        ."`last_visit_date`,`time_zone`,`language` )"
        ." SELECT "
        ."`id`,`person_userid`,`person_username`,`person_usertype`,`actor_gender`,"
        ."`person_useremail`,`person_given_name`,`person_family_name`,"
        ."`person_lastvisitdate`,`person_time_zone`,`person_language` "
        ." FROM `#__nodes`"
        ." WHERE `type` LIKE '%com:people.domain.entity.person'"
        ." ORDER BY `id`";
        dbexec($query);

        $query = "UPDATE `#__people_people` AS `p` "
        ."INNER JOIN `#__users` AS `u` ON `u`.`id` = `p`.`userid`"
        ." SET "
        ."`p`.`password` = `u`.`password`,"
        ."`p`.`last_visit_date` = `u`.`lastvisitDate`,"
        ."`p`.`activation_code` = `u`.`activation`";
        dbexec($query);

        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_userid`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_username`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_useremail`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_usertype`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_lastvisitdate`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `actor_gender`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_given_name`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_family_name`');
        dbexec('ALTER TABLE `#__nodes` DROP COLUMN `person_network_presence`');

        dbexec('ALTER TABLE `#__nodes` CHANGE `person_time_zone` `timezone` int(3) DEFAULT NULL');
        dbexec('ALTER TABLE `#__nodes` CHANGE `person_language` `language` VARCHAR(50) DEFAULT NULL');

        dbexec('ALTER TABLE `#__people_people` DROP COLUMN `userid`');

        dbexec('DROP TABLE IF EXISTS `#__users`');

        //update user and authentication plugins
        dbexec("UPDATE `#__plugins` SET `element` = 'anahita' WHERE `element` = 'joomla'");
        dbexec("UPDATE `#__plugins` SET `name` = 'User - Anahita' WHERE `folder` = 'user' AND `element` = 'anahita'");

        dbexec('ALTER TABLE `#__nodes` CHANGE name name VARCHAR(255) CHARACTER SET utf8mb4');
        dbexec('ALTER TABLE `#__nodes` CHANGE alias alias VARCHAR(255) CHARACTER SET utf8mb4');
        dbexec('ALTER TABLE `#__nodes` CHANGE body body MEDIUMTEXT CHARACTER SET utf8mb4');
        dbexec('ALTER TABLE `#__nodes` CHANGE excerpt excerpt TEXT CHARACTER SET utf8mb4');
    }
1023840
def upgrade():
    """"""
    op.create_index(op.f('ix_access_actionsroles_role_id'),
                    'access_actionsroles', ['role_id'], unique=False)
    op.drop_constraint(u'fk_access_actionsroles_role_id_accounts_role',
                       'access_actionsroles', type_='foreignkey')
    op.create_foreign_key(op.f('fk_access_actionsroles_role_id_accounts_role'),
                          'access_actionsroles', 'accounts_role', ['role_id'],
                          ['id'], ondelete='CASCADE')
    op.create_index(op.f('ix_access_actionsusers_user_id'),
                    'access_actionsusers', ['user_id'], unique=False)
    op.drop_constraint(u'fk_access_actionsusers_user_id_accounts_user',
                       'access_actionsusers', type_='foreignkey')
    op.create_foreign_key(op.f('fk_access_actionsusers_user_id_accounts_user'),
                          'access_actionsusers', 'accounts_user', ['user_id'],
                          ['id'], ondelete='CASCADE')