def do_upgrade():
    """ Implement your upgrades here  """
    if not op.has_table('remoteACCOUNT'):
        op.create_table(
            'remoteACCOUNT',
            db.Column('id', db.Integer(display_width=15), nullable=False),
            db.Column('user_id', db.Integer(display_width=15), nullable=False),
            db.Column('client_id', db.String(length=255), nullable=False),
            db.Column('extra_data', db.JSON, nullable=True),
            db.ForeignKeyConstraint(['user_id'], ['user.id'], ),
            db.PrimaryKeyConstraint('id'),
            db.UniqueConstraint('user_id', 'client_id'),
            mysql_charset='utf8',
            mysql_engine='MyISAM'
        )
    else:
        warnings.warn("*** Creation of table 'remoteACCOUNT table skipped!'")

    if not op.has_table('remoteTOKEN'):
        op.create_table(
            'remoteTOKEN',
            db.Column('id_remote_account', db.Integer(display_width=15),
                    nullable=False),
            db.Column('token_type', db.String(length=40), nullable=False),
            db.Column('access_token', db.Text(), nullable=False),
            db.Column('secret', db.Text(), nullable=False),
            db.ForeignKeyConstraint(['id_remote_account'],
                                    ['remoteACCOUNT.id'], ),
            db.PrimaryKeyConstraint('id_remote_account', 'token_type'),
            mysql_charset='utf8',
            mysql_engine='MyISAM'
        )
    else:
        warnings.warn("*** Creation of table 'remoteTOKEN' skipped!'")
Exemplo n.º 2
0
def do_upgrade():
    """Implement your upgrades here."""
    if not op.has_table('oauth2CLIENT'):
        op.create_table(
            'oauth2CLIENT',
            db.Column('name', db.String(length=40), nullable=True),
            db.Column('description', db.Text(), nullable=True),
            db.Column('website', URLType(), nullable=True),
            db.Column('user_id', db.Integer(15, unsigned=True), nullable=True),
            db.Column('client_id', db.String(length=255), nullable=False),
            db.Column('client_secret', db.String(length=255), nullable=False),
            db.Column('is_confidential', db.Boolean(), nullable=True),
            db.Column('is_internal', db.Boolean(), nullable=True),
            db.Column('_redirect_uris', db.Text(), nullable=True),
            db.Column('_default_scopes', db.Text(), nullable=True),
            db.ForeignKeyConstraint(['user_id'], ['user.id'], ),
            db.PrimaryKeyConstraint('client_id'),
            mysql_charset='utf8',
            mysql_engine='MyISAM'
        )
    else:
        warnings.warn("*** Creation of table 'oauth2CLIENT' skipped!")

    if not op.has_table('oauth2TOKEN'):
        op.create_table(
            'oauth2TOKEN',
            db.Column('id', db.Integer(15, unsigned=True), autoincrement=True,
                      nullable=False),
            db.Column('client_id', db.String(length=40), nullable=False),
            db.Column('user_id', db.Integer(15, unsigned=True), nullable=True),
            db.Column('token_type', db.String(length=255), nullable=True),
            db.Column('access_token', db.String(length=255), nullable=True),
            db.Column('refresh_token', db.String(length=255), nullable=True),
            db.Column('expires', db.DateTime(), nullable=True),
            db.Column('_scopes', db.Text(), nullable=True),
            db.Column('is_personal', db.Boolean(), nullable=True),
            db.Column('is_internal', db.Boolean(), nullable=True),
            db.ForeignKeyConstraint(
                ['client_id'], ['oauth2CLIENT.client_id'],),
            db.ForeignKeyConstraint(['user_id'], ['user.id'], ),
            db.PrimaryKeyConstraint('id'),
            db.UniqueConstraint('access_token'),
            db.UniqueConstraint('refresh_token'),
            mysql_charset='utf8',
            mysql_engine='MyISAM'
        )
    else:
        warnings.warn("*** Creation of table 'oauth2TOKEN' skipped!")
Exemplo n.º 3
0
def do_upgrade():
    """Upgrades."""
    op.add_column(
        u'pages', db.Column('description',
                            db.String(length=200),
                            nullable=True))
    op.create_table('pagesLIST',
                    db.Column('id',
                              db.Integer(15, unsigned=True),
                              nullable=False),
                    db.Column('list_id',
                              db.Integer(15, unsigned=True),
                              nullable=False),
                    db.Column('page_id',
                              db.Integer(15, unsigned=True),
                              nullable=False),
                    db.Column('order',
                              db.Integer(15, unsigned=True),
                              nullable=False),
                    db.PrimaryKeyConstraint('id'),
                    db.ForeignKeyConstraint(
                        ['list_id'],
                        [u'pages.id'],
                    ),
                    db.ForeignKeyConstraint(
                        ['page_id'],
                        [u'pages.id'],
                    ),
                    mysql_charset='utf8',
                    mysql_engine='MyISAM')
Exemplo n.º 4
0
def do_upgrade():
    """Implement your upgrades here."""
    op.create_table('communityFEATURED',
                    db.Column('id', db.Integer(), nullable=False),
                    db.Column('id_community', db.String(length=100),
                              nullable=False),
                    db.Column('start_date', db.DateTime(), nullable=False),
                    db.ForeignKeyConstraint(['id_community'],
                                            ['community.id'], ),
                    db.PrimaryKeyConstraint('id'),
                    mysql_charset='utf8',
                    mysql_engine='MyISAM'
                    )
def do_upgrade():
    """Implement your upgrades here."""
    op.create_table('quotaUSAGE',
    db.Column('id', db.Integer(display_width=15), nullable=False),
    db.Column('object_type', db.String(length=40), nullable=True),
    db.Column('object_id', db.String(length=250), nullable=True),
    db.Column('metric', db.String(length=40), nullable=True),
    db.Column('value', db.BigInteger(), nullable=False),
    db.Column('modified', db.DateTime(), nullable=False),
    db.PrimaryKeyConstraint('id'),
    db.UniqueConstraint('object_type', 'object_id', 'metric'),
    mysql_charset='utf8',
    mysql_engine='MyISAM'
    )
    op.create_index(op.f('ix_quotaUSAGE_object_id'), 'quotaUSAGE', ['object_id'], unique=False)
    op.create_index(op.f('ix_quotaUSAGE_object_type'), 'quotaUSAGE', ['object_type'], unique=False)
def do_upgrade():
    """ Implement your upgrades here  """
    op.create_table('pages',
                    db.Column('id',
                              mysql.INTEGER(display_width=15),
                              nullable=False),
                    db.Column('url', db.String(length=100), nullable=False),
                    db.Column('title', db.String(length=200), nullable=True),
                    db.Column('content',
                              db.TEXT(length=4294967294),
                              nullable=True),
                    db.Column('template_name',
                              db.String(length=70),
                              nullable=True),
                    db.Column('created', db.DateTime(), nullable=False),
                    db.Column('last_modified', db.DateTime(), nullable=False),
                    db.PrimaryKeyConstraint('id'),
                    db.UniqueConstraint('url'),
                    mysql_charset='utf8',
                    mysql_engine='MyISAM')
Exemplo n.º 7
0
def do_upgrade():
    """Add the table with facets configuration."""
    if not op.has_table('facet_collection'):
        op.create_table('facet_collection',
                        db.Column('id', mysql.INTEGER(), nullable=False),
                        db.Column('id_collection',
                                  mysql.INTEGER(),
                                  nullable=False),
                        db.Column('order', mysql.INTEGER(), nullable=False),
                        db.Column('facet_name',
                                  db.String(length=80),
                                  nullable=False),
                        db.ForeignKeyConstraint(
                            ['id_collection'],
                            ['collection.id'],
                        ),
                        db.PrimaryKeyConstraint('id'),
                        mysql_charset='utf8',
                        mysql_engine='MyISAM')
    else:
        warnings.warn("*** Creation of table 'facet_collection' skipped!")
def do_upgrade():
    """Perfrom upgrade."""
    if op.has_table('usergroup'):
        op.rename_table(old_table_name='usergroup', new_table_name='group')
        with op.batch_alter_table("group") as batch_op:
            batch_op.drop_index('ix_usergroup_name')
            batch_op.create_index('ix_group_name', ['name'], unique=True)
            batch_op.alter_column('name', server_default=None)
            batch_op.add_column(
                db.Column('is_managed',
                          db.Boolean(),
                          nullable=False,
                          default=False))
            batch_op.alter_column(column_name='join_policy',
                                  new_column_name='privacy_policy',
                                  type_=db.String(length=1),
                                  nullable=False)
            batch_op.drop_index('login_method_name')
            batch_op.alter_column(column_name='login_method',
                                  new_column_name='subscription_policy',
                                  type_=db.String(length=1),
                                  nullable=False,
                                  server_default=None)
            batch_op.add_column(
                db.Column('created',
                          db.DateTime(),
                          nullable=False,
                          default=datetime.now))
            batch_op.add_column(
                db.Column('modified',
                          db.DateTime(),
                          nullable=False,
                          default=datetime.now,
                          onupdate=datetime.now))
    else:
        op.create_table('group',
                        db.Column('id',
                                  db.Integer(15, unsigned=True),
                                  nullable=False,
                                  autoincrement=True),
                        db.Column('name',
                                  db.String(length=255),
                                  nullable=False,
                                  unique=True,
                                  index=True),
                        db.Column('description',
                                  db.Text,
                                  nullable=True,
                                  default=''),
                        db.Column('is_managed',
                                  db.Boolean(),
                                  default=False,
                                  nullable=False),
                        db.Column('privacy_policy',
                                  db.String(length=1),
                                  nullable=False),
                        db.Column('subscription_policy',
                                  db.String(length=1),
                                  nullable=False),
                        db.Column('created',
                                  db.DateTime,
                                  nullable=False,
                                  default=datetime.now),
                        db.Column('modified',
                                  db.DateTime,
                                  nullable=False,
                                  default=datetime.now,
                                  onupdate=datetime.now),
                        db.PrimaryKeyConstraint('id'),
                        mysql_charset='utf8',
                        mysql_engine='MyISAM')

    if op.has_table('user_usergroup'):
        op.rename_table(old_table_name='user_usergroup',
                        new_table_name='groupMEMBER')
        with op.batch_alter_table("groupMEMBER") as batch_op:
            batch_op.drop_index('id_usergroup')
            batch_op.alter_column('id_user', server_default=None)
            batch_op.alter_column(column_name='id_usergroup',
                                  new_column_name='id_group',
                                  existing_type=db.Integer(15, unsigned=True),
                                  nullable=False)
            batch_op.create_index('id_group', ['id_group'])
            batch_op.alter_column(column_name='user_status',
                                  new_column_name='state',
                                  type_=db.String(length=1),
                                  nullable=False)
            batch_op.drop_column('user_status_date')
            batch_op.add_column(
                db.Column('modified',
                          db.DateTime(),
                          nullable=False,
                          default=datetime.now,
                          onupdate=datetime.now))
            batch_op.add_column(
                db.Column('created',
                          db.DateTime(),
                          nullable=False,
                          default=datetime.now))
    else:
        op.create_table('groupMEMBER',
                        db.Column('id_user',
                                  db.Integer(15, unsigned=True),
                                  nullable=False),
                        db.Column('id_group', db.Integer(15, unsigned=True)),
                        db.Column('state', db.String(length=1),
                                  nullable=False),
                        db.Column('created',
                                  db.DateTime(),
                                  nullable=False,
                                  default=datetime.now),
                        db.Column('modified',
                                  db.DateTime(),
                                  nullable=False,
                                  default=datetime.now,
                                  onupdate=datetime.now),
                        db.ForeignKeyConstraint(
                            ['id_group'],
                            [u'group.id'],
                        ),
                        db.ForeignKeyConstraint(
                            ['id_user'],
                            [u'user.id'],
                        ),
                        db.PrimaryKeyConstraint('id_user', 'id_group'),
                        mysql_charset='utf8',
                        mysql_engine='MyISAM')

    op.create_table('groupADMIN',
                    db.Column('id',
                              db.Integer(15, unsigned=True),
                              nullable=False,
                              autoincrement=True),
                    db.Column('group_id', db.Integer(15, unsigned=True)),
                    db.Column('admin_type', db.Unicode(255)),
                    db.Column('admin_id', db.Integer),
                    db.ForeignKeyConstraint(
                        ['group_id'],
                        [u'group.id'],
                    ),
                    db.PrimaryKeyConstraint('id', 'group_id'),
                    mysql_charset='utf8',
                    mysql_engine='MyISAM')
Exemplo n.º 9
0
def do_upgrade():
    op.create_table('accreqREQUEST',
                    db.Column('id',
                              db.Integer(display_width=15),
                              nullable=False),
                    db.Column('status', db.String(length=1), nullable=False),
                    db.Column('receiver_user_id',
                              db.Integer(display_width=15),
                              nullable=False),
                    db.Column('sender_user_id',
                              db.Integer(display_width=15),
                              nullable=True),
                    db.Column('sender_full_name',
                              db.String(length=255),
                              nullable=False),
                    db.Column('sender_email',
                              db.String(length=255),
                              nullable=False),
                    db.Column('recid',
                              db.Integer(display_width=15),
                              nullable=False),
                    db.Column('created', db.DateTime(), nullable=False),
                    db.Column('modified', db.DateTime(), nullable=False),
                    db.Column('justification', db.Text(), nullable=False),
                    db.Column('message', db.Text(), nullable=False),
                    db.Column('link_id',
                              db.Integer(display_width=15),
                              nullable=True),
                    db.ForeignKeyConstraint(
                        ['receiver_user_id'],
                        [u'user.id'],
                    ),
                    db.ForeignKeyConstraint(
                        ['sender_user_id'],
                        [u'user.id'],
                    ),
                    db.ForeignKeyConstraint(
                        ['link_id'],
                        [u'accreqLINK.id'],
                    ),
                    db.PrimaryKeyConstraint('id'),
                    mysql_charset='utf8',
                    mysql_engine='MyISAM')
    op.create_index(op.f('ix_accreqREQUEST_created'),
                    'accreqREQUEST', ['created'],
                    unique=False)
    op.create_index(op.f('ix_accreqREQUEST_recid'),
                    'accreqREQUEST', ['recid'],
                    unique=False)
    op.create_index(op.f('ix_accreqREQUEST_status'),
                    'accreqREQUEST', ['status'],
                    unique=False)

    op.create_table('accreqLINK',
                    db.Column('id',
                              db.Integer(display_width=15),
                              nullable=False),
                    db.Column('token', db.Text(), nullable=False),
                    db.Column('owner_user_id',
                              db.Integer(display_width=15),
                              nullable=False),
                    db.Column('created', db.DateTime(), nullable=False),
                    db.Column('expires_at', db.DateTime(), nullable=True),
                    db.Column('revoked_at', db.DateTime(), nullable=True),
                    db.Column('title', db.String(length=255), nullable=False),
                    db.Column('description', db.Text(), nullable=False),
                    db.ForeignKeyConstraint(
                        ['owner_user_id'],
                        [u'user.id'],
                    ),
                    db.PrimaryKeyConstraint('id'),
                    mysql_charset='utf8',
                    mysql_engine='MyISAM')
    op.create_index(op.f('ix_accreqLINK_created'),
                    'accreqLINK', ['created'],
                    unique=False)
    op.create_index(op.f('ix_accreqLINK_revoked_at'),
                    'accreqLINK', ['revoked_at'],
                    unique=False)