Ejemplo n.º 1
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'users', sa.Column('user_md5', mysql.VARCHAR(length=45),
                           nullable=True))
    op.create_index('user_md5_UNIQUE', 'users', ['user_md5'], unique=True)
    op.drop_index(op.f('ix_ratings_user_id'), table_name='ratings')
    op.drop_index(op.f('ix_ratings_m_id'), table_name='ratings')
    op.create_table('ratings2',
                    sa.Column('rating_id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('user_md5', mysql.TEXT(), nullable=True),
                    sa.Column('m_id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('rating',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('rating_time', mysql.TEXT(), nullable=True),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
Ejemplo n.º 2
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'discord_server_lists',
        sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
        sa.Column('invite_id', sa.String(length=45), nullable=False),
        sa.Column('category_id',
                  mysql.INTEGER(display_width=11),
                  nullable=True), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'discord_server_categories',
        sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
        sa.Column('guild_id', mysql.BIGINT(display_width=20), nullable=False),
        sa.Column('channel_id', mysql.BIGINT(display_width=20),
                  nullable=False),
        sa.Column('category_title', sa.String(length=200), nullable=False),
        sa.Column('category_description', sa.String(length=200),
                  nullable=True), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_audit_generated_games_hash_id'),
                    'audit_generated_games', ['hash_id'],
                    unique=False)
    op.drop_index('idx_audit_generated_games_hash_id',
                  table_name='audit_generated_games')
    op.create_index(op.f('ix_audit_messages_message_id'),
                    'audit_messages', ['message_id'],
                    unique=False)
    op.drop_index('idx_audit_messages_message_id', table_name='audit_messages')
    op.create_index(op.f('ix_srlnick_srl_nick'),
                    'srlnick', ['srl_nick'],
                    unique=False)
    op.create_index(op.f('ix_srlnick_twitch_name'),
                    'srlnick', ['twitch_name'],
                    unique=False)
    op.drop_index('idx_srlnick_srl_nick', table_name='srlnick')
    op.drop_index('idx_srlnick_twitch_name', table_name='srlnick')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('fk_urf_resources_fulfilled', 'user_resource_fulfillment', type_='foreignkey')
    op.drop_constraint('fk_urf_resources_fulfilling', 'user_resource_fulfillment', type_='foreignkey')
    op.create_foreign_key('user_resource_fulfillment_ibfk_1', 'user_resource_fulfillment', 'user_resources', ['fulfilled_resource_id'], ['id'], onupdate='CASCADE')
    op.create_foreign_key('user_resource_fulfillment_ibfk_2', 'user_resource_fulfillment', 'user_resources', ['fulfilling_resource_id'], ['id'], onupdate='CASCADE')
    op.create_table('user_resources',
    sa.Column('created_at', mysql.DATETIME(), nullable=False),
    sa.Column('updated_at', mysql.DATETIME(), nullable=False),
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('user_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('type', mysql.VARCHAR(length=8), nullable=True),
    sa.Column('quantity_available', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('quantity_needed', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('fulfilled', mysql.TINYINT(display_width=1), server_default=sa.text("'0'"), autoincrement=False, nullable=False),
    sa.Column('category_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['category_id'], ['categories.id'], name='fk_user_resources_categories', onupdate='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='user_resources_ibfk_2', onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.drop_index(op.f('ix_resources_updated_at'), table_name='resources')
    op.drop_index(op.f('ix_resources_type'), table_name='resources')
    op.drop_index(op.f('ix_resources_created_at'), table_name='resources')
    op.drop_table('resources')
Ejemplo n.º 4
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('series',
                    'name',
                    existing_type=mysql.VARCHAR(length=255),
                    nullable=True)
    op.alter_column('series',
                    'igdb_id',
                    existing_type=mysql.BIGINT(display_width=20),
                    nullable=True)
    op.alter_column('genres',
                    'name',
                    existing_type=mysql.VARCHAR(length=255),
                    nullable=True)
    op.alter_column('genres',
                    'igdb_id',
                    existing_type=mysql.BIGINT(display_width=20),
                    nullable=True)
    op.alter_column('games',
                    'name',
                    existing_type=mysql.VARCHAR(length=255),
                    nullable=True)
    op.alter_column('games',
                    'igdb_id',
                    existing_type=mysql.BIGINT(display_width=20),
                    nullable=True)
    op.alter_column('companies',
                    'name',
                    existing_type=mysql.VARCHAR(length=255),
                    nullable=True)
    op.alter_column('companies',
                    'igdb_id',
                    existing_type=mysql.BIGINT(display_width=20),
                    nullable=True)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'video',
        sa.Column('thanks',
                  mysql.BIGINT(display_width=20),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'video',
        sa.Column('unlike',
                  mysql.BIGINT(display_width=20),
                  autoincrement=False,
                  nullable=True))
    op.drop_index(op.f('ix_user_log_ip'), table_name='user_log')
    op.drop_column('user_log', 'info')
    op.add_column(
        'user',
        sa.Column('like_num',
                  mysql.BIGINT(display_width=20),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'user',
        sa.Column('thanks_num',
                  mysql.BIGINT(display_width=20),
                  autoincrement=False,
                  nullable=True))
    op.drop_column('user', 'get_like_num')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('migrations')
    op.drop_index('source_index', table_name='source')
    op.create_unique_constraint(None, 'source', ['url'])
    op.create_unique_constraint(None, 'source', ['feed_link'])
    op.drop_index('source_subscription_index', table_name='source_subscription')
    op.alter_column('user', 'email',
               existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=255),
               nullable=True)
    op.drop_index('user_index', table_name='user')
    op.create_unique_constraint(None, 'user', ['social_id'])
    # ### end Alembic commands ###

    op.create_table('post',
        sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), autoincrement=True, nullable=False),
        sa.Column('source_id', mysql.BIGINT(display_width=20, unsigned=True), nullable=False),
        sa.Column('title', mysql.VARCHAR(length=255), nullable=False),
        sa.Column('content', mysql.TEXT(), nullable=False),
        sa.Column('link', mysql.VARCHAR(length=2000), nullable=False),
        sa.Column('author', mysql.VARCHAR(length=255), nullable=False),

        sa.Column('fetched_at', mysql.TIMESTAMP(), nullable=True),
        sa.Column('published_at', mysql.TIMESTAMP(), nullable=True),
        sa.Column('updated_at', mysql.TIMESTAMP(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_collate='utf8mb4_unicode_ci',
        mysql_default_charset='utf8mb4',
        mysql_engine='InnoDB'
    )

    op.create_index('post_index', 'post', ['source_id', 'fetched_at', 'published_at'])
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'permissions',
        sa.Column('id', mysql.BIGINT(), nullable=False, autoincrement=False),
        sa.Column('permission', sa.VARCHAR(length=100), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_permissions_permission'),
                    'permissions', ['permission'],
                    unique=True)
    op.create_table(
        'agent_permission',
        sa.Column('agent_id', mysql.INTEGER(), nullable=True),
        sa.Column('permission_id', mysql.BIGINT(), nullable=True),
        sa.ForeignKeyConstraint(
            ['agent_id'],
            ['tokens.agent_id'],
        ), sa.ForeignKeyConstraint(
            ['permission_id'],
            ['permissions.id'],
        ))
    op.create_index('agent_id_permission_id',
                    'agent_permission', ['agent_id', 'permission_id'],
                    unique=False)
    query = 'INSERT INTO `permissions` (`id`, `permission`) VALUES (4, "apply_voucher"), (3, "check_voucher"), (1, "create_voucher"), (5, "fetch_voucher"),(0, "no_permission_required"), (7, "test"), (6, "update_order_status"), (2, "update_voucher")'
    op.execute(text(query))
    query = 'delete from tokens where agent_id=0'
    op.execute(text(query))
    query = 'INSERT INTO `tokens` (`token`, `agent_id`, `agent_name`, `created_at`, `last_accessed_at`) VALUES ("anonymous", 0, "anonymous", "2016-06-10 13:53:53.000000", "2016-06-10 13:53:53.000000")'
    op.execute(text(query))
    query = 'INSERT INTO `agent_permission` (`agent_id`, `permission_id`) VALUES (0, 1),(0, 2),(0, 5),(0, 6)'
    op.execute(text(query))
Ejemplo n.º 8
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('ns_users', 'password_hash')
    op.create_table('ns_rooms',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('number', mysql.VARCHAR(length=5), nullable=True),
    sa.Column('name', mysql.VARCHAR(length=20), nullable=True),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('updated_at', mysql.DATETIME(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('ns_books',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('room_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('checkin_on', sa.DATE(), nullable=True),
    sa.Column('checkout_on', sa.DATE(), nullable=True),
    sa.Column('user_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('updated_at', mysql.DATETIME(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], [u'ns_users.id'], name=u'ns_books_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('ns_room_books',
    sa.Column('room_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('book_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['book_id'], [u'ns_books.id'], name=u'ns_room_books_ibfk_2'),
    sa.ForeignKeyConstraint(['room_id'], [u'ns_rooms.id'], name=u'ns_room_books_ibfk_1'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
Ejemplo n.º 9
0
class User(BASE):
    __tablename__ = "users_main"
    id = Column("ID", mysql.INTEGER(10, unsigned=True), primary_key=True)
    username = Column('Username', mysql.VARCHAR(20))
    email = Column('Email', mysql.VARCHAR(255))
    pass_hash = Column('PassHash', mysql.VARCHAR(60))
    secret = Column('Secret', mysql.VARCHAR(32))
    irc_key = Column('IRCKey', mysql.CHAR(32))
    last_login = Column('LastLogin', mysql.DATETIME)
    last_access = Column('LastAccess', mysql.DATETIME)
    ip = Column('IP', mysql.VARCHAR(15))
    class_id = Column('Class', mysql.TINYINT(2))
    uploaded = Column('Uploaded', mysql.BIGINT(20, unsigned=True))
    downloaded = Column('Downloaded', mysql.BIGINT(20, unsigned=True))
    title = Column('Title', mysql.TEXT)
    enabled = Column('Enabled', mysql.ENUM('0', '1', '2'))
    paranoia = Column('Paranoia', mysql.TEXT)
    visible = Column('Visible', mysql.ENUM('1', '0'))
    invites = Column('Invites', mysql.INTEGER(10, unsigned=True))
    permission_id = Column('PermissionID', mysql.INTEGER(10, unsigned=True),
                           ForeignKey('permissions.ID'))
    custom_permissions = Column('CustomPermissions', mysql.TEXT)
    can_leech = Column('can_leech', mysql.TINYINT(4))
    torrent_pass = Column('torrent_pass', mysql.CHAR(32))
    required_ratio = Column('RequiredRatio', mysql.DOUBLE(10, 8))
    required_ratio_work = Column('RequiredRatioWork', mysql.DOUBLE(10, 8))
    ipcc = Column('ipcc', mysql.VARCHAR(2))
    fl_tokens = Column('FLTokens', mysql.INTEGER(10))

    permission_class = relationship("Permissions")

    info = relationship("UsersInfo")

    def get_paranoia(self):
        return dict_to_list(unserialize(bytes(str(self.paranoia), 'utf-8')))
Ejemplo n.º 10
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cart_products',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('cart_id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('product_id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('quantity',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(['cart_id'], ['cart.id'],
                                            name='cart_products_ibfk_1'),
                    sa.ForeignKeyConstraint(['product_id'], ['product.id'],
                                            name='cart_products_ibfk_2'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='latin1',
                    mysql_engine='InnoDB')
Ejemplo n.º 11
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('department_tree',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              nullable=False),
                    sa.Column('department_id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('parent_id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('depth',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_index('idx_department_tree_p',
                    'department_tree', ['parent_id'],
                    unique=False)
    op.create_index('idx_department_tree_d',
                    'department_tree', ['department_id'],
                    unique=False)
    op.drop_index('idx_department_tree_p', table_name='department_closure')
    op.drop_index('idx_department_tree_d', table_name='department_closure')
    op.drop_table('department_closure')
Ejemplo n.º 12
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('employee', 'department_id')
    op.add_column(
        'department_tree',
        sa.Column('parent_path', mysql.VARCHAR(length=128), nullable=False))
    op.drop_index('idx_department_tree_p', table_name='department_tree')
    op.drop_index('idx_department_tree_d', table_name='department_tree')
    op.drop_column('department_tree', 'parent_id')
    op.drop_column('department_tree', 'depth')
    op.drop_column('department_tree', 'department_id')
    op.add_column(
        'department_permission',
        sa.Column('leader_only',
                  mysql.TINYINT(display_width=1),
                  autoincrement=False,
                  nullable=False))
    op.drop_index('idx_department_permission_d',
                  table_name='department_permission')
    op.create_table('employee_department',
                    sa.Column('employee_id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              nullable=False),
                    sa.Column('department_id',
                              mysql.BIGINT(display_width=20, unsigned=True),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('employee_id'),
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.drop_index('idx_leader_permission_d', table_name='leader_permission')
    op.drop_table('leader_permission')
Ejemplo n.º 13
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tb_file',
                    sa.Column('id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('mission_url',
                              mysql.VARCHAR(length=128),
                              nullable=True),
                    sa.Column('mission_name',
                              mysql.VARCHAR(length=64),
                              nullable=True),
                    sa.Column('file_url',
                              mysql.VARCHAR(length=128),
                              nullable=True),
                    sa.Column('file_name',
                              mysql.VARCHAR(length=64),
                              nullable=True),
                    sa.Column('student_id',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(['student_id'], ['tb_student.id'],
                                            name='tb_file_ibfk_1'),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='gb2312',
                    mysql_engine='InnoDB')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'smz3_multiworld',
        sa.Column('message_id', mysql.BIGINT(display_width=20),
                  nullable=False),
        sa.Column('owner_id', mysql.BIGINT(display_width=20), nullable=False),
        sa.Column('status', mysql.VARCHAR(length=20), nullable=False),
        sa.PrimaryKeyConstraint('message_id'))
Ejemplo n.º 15
0
def upgrade():
    op.create_table(
        'perf_importer_cycle_infos',
        sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
        sa.Column('execution_date', mysql.DATETIME(), nullable=True),
        sa.Column('prediction_start_date', mysql.DATETIME(), nullable=True),
        sa.Column('prediction_end_date', mysql.DATETIME(), nullable=True),
        sa.Column('file_name', mysql.TEXT(collation='utf8mb4_unicode_ci'), nullable=True),
        sa.Column('computed', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
        sa.Column('on_google_sheets', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_collate='utf8mb4_unicode_ci',
        mysql_default_charset='utf8mb4',
        mysql_engine='InnoDB'
    )
    op.create_table(
        'perf_division_per_rome',
        sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
        sa.Column('importer_cycle_infos_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
        sa.Column('codenaf', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=8), nullable=False),
        sa.Column('coderome', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=8), nullable=False),
        sa.Column('threshold_lbb', mysql.FLOAT(), nullable=True),
        sa.Column('threshold_lba', mysql.FLOAT(), nullable=True),
        sa.Column('nb_bonne_boites_lbb', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('nb_bonne_boites_lba', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['importer_cycle_infos_id'], ['perf_importer_cycle_infos.id'], name='perf_division_per_rome_ibfk_1', ondelete='SET NULL'),
        sa.PrimaryKeyConstraint('id'),
        mysql_collate='utf8mb4_unicode_ci',
        mysql_default_charset='utf8mb4',
        mysql_engine='InnoDB'
    )
    op.create_table(
        'perf_prediction_and_effective_hirings',
        sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
        sa.Column('importer_cycle_infos_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
        sa.Column('siret', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=191), nullable=True),
        sa.Column('codenaf', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=8), nullable=True),
        sa.Column('codecommune', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=191), nullable=True),
        sa.Column('codepostal', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=8), nullable=True),
        sa.Column('departement', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=8), nullable=True),
        sa.Column('raisonsociale', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=191), nullable=True),
        sa.Column('enseigne', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=191), nullable=True),
        sa.Column('lbb_nb_predicted_hirings', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('lba_nb_predicted_hirings', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('lbb_nb_predicted_hirings_score', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('lba_nb_predicted_hirings_score', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('lbb_nb_effective_hirings', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('lba_nb_effective_hirings', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
        sa.Column('is_a_bonne_boite', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
        sa.Column('is_a_bonne_alternance', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['importer_cycle_infos_id'], ['perf_importer_cycle_infos.id'], name='perf_prediction_and_effective_hirings_ibfk_1', ondelete='SET NULL'),
        sa.PrimaryKeyConstraint('id'),
        mysql_collate='utf8mb4_unicode_ci',
        mysql_default_charset='utf8mb4',
        mysql_engine='InnoDB'
    )
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('all_vouchers_log_sequence',
                    sa.Column('id', mysql.BIGINT(), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'all_vouchers_log', sa.Column('auto_id',
                                      mysql.BIGINT(),
                                      nullable=False),
        sa.Column('change_id', mysql.BIGINT(), nullable=False),
        sa.Column('changed_on', mysql.DATETIME(fsp=6), nullable=False),
        sa.Column('id', sa.BINARY(length=16), nullable=True),
        sa.Column('code', sa.VARCHAR(length=200), nullable=False),
        sa.Column('rules', sa.VARCHAR(length=150), nullable=False),
        sa.Column('custom', sa.VARCHAR(length=1000), nullable=True),
        sa.Column('description', sa.VARCHAR(length=255), nullable=True),
        sa.Column('from', mysql.DATETIME(fsp=6), nullable=True),
        sa.Column('to', mysql.DATETIME(fsp=6), nullable=True),
        sa.Column('schedule', sa.VARCHAR(length=250), nullable=True),
        sa.Column('mutable',
                  mysql.TINYINT(display_width=3, unsigned=True),
                  nullable=True),
        sa.Column('is_active',
                  mysql.TINYINT(display_width=3, unsigned=True),
                  nullable=False),
        sa.Column('type', mysql.TINYINT(unsigned=True), nullable=False),
        sa.Column('created_by', sa.VARCHAR(length=32), nullable=False),
        sa.Column('updated_by', sa.VARCHAR(length=32), nullable=False),
        sa.Column('created_at', mysql.DATETIME(fsp=6), nullable=False),
        sa.Column('updated_at', mysql.DATETIME(fsp=6), nullable=False),
        sa.Column('agent_id', mysql.INTEGER(), nullable=True),
        sa.PrimaryKeyConstraint('auto_id'))
    op.create_index(op.f('ix_all_vouchers_log_change_id'),
                    'all_vouchers_log', ['change_id'],
                    unique=False)
    op.create_index(op.f('ix_all_vouchers_log_changed_on'),
                    'all_vouchers_log', ['changed_on'],
                    unique=False)
    op.create_index(op.f('ix_all_vouchers_log_code'),
                    'all_vouchers_log', ['code'],
                    unique=False)
    op.create_index(op.f('ix_all_vouchers_log_id'),
                    'all_vouchers_log', ['id'],
                    unique=False)
    op.add_column(u'all_vouchers',
                  sa.Column('is_active', sa.BOOLEAN(), nullable=False))
    op.create_index(op.f('ix_all_vouchers_from'),
                    'all_vouchers', ['from'],
                    unique=False)
    op.create_index(op.f('ix_all_vouchers_to'),
                    'all_vouchers', ['to'],
                    unique=False)
    op.create_index('user_voucher_transaction_log_order_id',
                    'user_voucher_transaction_log', ['order_id'],
                    unique=False)
Ejemplo n.º 17
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('invtypes', sa.Column('portionSize', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('basePrice', mysql.DECIMAL(precision=19, scale=4), nullable=True))
    op.add_column('invtypes', sa.Column('mass', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column('invtypes', sa.Column('soundID', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('volume', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column('invtypes', sa.Column('published', mysql.TINYINT(display_width=4), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('iconID', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('raceID', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('capacity', mysql.DOUBLE(asdecimal=True), nullable=True))
Ejemplo n.º 18
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'session',
        sa.Column(u'end_time', mysql.BIGINT(display_width=20), nullable=True))
    op.add_column(
        'session',
        sa.Column(u'start_time', mysql.BIGINT(display_width=20),
                  nullable=True))
    op.drop_column('session', 'start')
    op.drop_column('session', 'end')
Ejemplo n.º 19
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cart_products',
    sa.Column('id', mysql.BIGINT(unsigned=True), nullable=False),
    sa.Column('cart_id', sa.Integer(), nullable=False),
    sa.Column('product_id', mysql.BIGINT(unsigned=True), nullable=False),
    sa.Column('quantity', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['cart_id'], ['cart.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
Ejemplo n.º 20
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('games',
                    sa.Column('gameID',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('key',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              nullable=True),
                    sa.Column('name',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              nullable=True),
                    sa.Column('roleID',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('gameID'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_table('applications',
                    sa.Column('applicationID',
                              mysql.BIGINT(display_width=20),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('name',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              nullable=True),
                    sa.PrimaryKeyConstraint('applicationID'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_table('applications_games',
                    sa.Column('applicationID',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('gameID',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=False),
                    sa.ForeignKeyConstraint(['applicationID'],
                                            ['applications.applicationID'],
                                            name='applications_games_ibfk_1'),
                    sa.ForeignKeyConstraint(['gameID'], ['games.gameID'],
                                            name='applications_games_ibfk_2'),
                    sa.PrimaryKeyConstraint('applicationID', 'gameID'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
Ejemplo n.º 21
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'messenger_user',
        sa.Column('id', mysql.BIGINT(unsigned=True), nullable=False),
        sa.Column('sender_id', sa.String(length=255), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('sender_id'))
    op.alter_column('product',
                    'category_id',
                    existing_type=mysql.BIGINT(display_width=20,
                                               unsigned=True),
                    nullable=False)
Ejemplo n.º 22
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('delivery_order',
    sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
    sa.Column('user_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('order_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('pickup_address', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('pickup_contact', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('pickup_contact_number', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('dropoff_address', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('dropoff_contact', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('dropoff_contact_number', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('item_value_cost', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('notes', mysql.TEXT(), nullable=False),
    sa.Column('delivery_fee', mysql.DOUBLE(asdecimal=True), nullable=False),
    sa.Column('invoice_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('mpesa_payment_id', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('date_created', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('order_status', mysql.VARCHAR(length=255), server_default=sa.text("'New'"), nullable=True),
    sa.Column('rider_id', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('rider_pickup_date', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('rider_delivery_date', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('rider_notes', mysql.TEXT(), nullable=True),
    sa.Column('user_feedback', mysql.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('user',
    sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
    sa.Column('user_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('firstname', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('lastname', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('email', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('phone_number', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('push_notificaiton_id', mysql.TEXT(), nullable=True),
    sa.Column('date_created', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('phone_number_verified', mysql.INTEGER(display_width=11), server_default=sa.text('0'), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('login',
    sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
    sa.Column('user_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('email_address', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('password', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('role', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
    sa.Column('status', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
    sa.Column('date_created', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('last_login', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.drop_table('users')
    op.drop_table('blacklist_tokens')
Ejemplo n.º 23
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('certificates', 'is_ev')
    op.drop_column('certificates', 'is_cn_wildcard')
    op.drop_column('certificates', 'is_alt_wildcard')
    op.create_table('user_ip_scan_record',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=False),
    sa.Column('ip_scan_record_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('updated_at', mysql.DATETIME(), nullable=True),
    sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
    sa.Column('disabled_at', mysql.DATETIME(), nullable=True),
    sa.Column('scan_periodicity', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('auto_fill_watches', mysql.SMALLINT(display_width=6), server_default=sa.text(u"'0'"), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['ip_scan_record_id'], [u'ip_scan_record.id'], name=u'fk_ip_scan_record_ip_scan_record_id', ondelete=u'CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], name=u'fk_user_ip_scan_record_users_id', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('user_subdomain_watch_target',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=False),
    sa.Column('watch_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('updated_at', mysql.DATETIME(), nullable=True),
    sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
    sa.Column('disabled_at', mysql.DATETIME(), nullable=True),
    sa.Column('auto_scan_added_at', mysql.DATETIME(), nullable=True),
    sa.Column('scan_periodicity', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('scan_type', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('auto_fill_watches', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], name=u'wa_sub_users_id', ondelete=u'CASCADE'),
    sa.ForeignKeyConstraint(['watch_id'], [u'subdomain_watch_target.id'], name=u'wa_sub_watch_target_id', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('user_watch_target',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=False),
    sa.Column('watch_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('updated_at', mysql.DATETIME(), nullable=True),
    sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
    sa.Column('scan_periodicity', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('scan_type', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('auto_scan_added_at', mysql.DATETIME(), nullable=True),
    sa.Column('disabled_at', mysql.DATETIME(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], name=u'wa_users_id', ondelete=u'CASCADE'),
    sa.ForeignKeyConstraint(['watch_id'], [u'watch_target.id'], name=u'wa_watch_target_id', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('last_record_cache',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('record_key', mysql.VARCHAR(length=191), nullable=False),
    sa.Column('record_at', mysql.DATETIME(), nullable=True),
    sa.Column('record_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('record_aux', mysql.TEXT(), nullable=True),
    sa.Column('created_at', mysql.DATETIME(), nullable=True),
    sa.Column('updated_at', mysql.DATETIME(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
Ejemplo n.º 25
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'product', sa.Column('id', mysql.BIGINT(unsigned=True),
                             nullable=False),
        sa.Column('name', sa.String(length=30), nullable=False),
        sa.Column('description', sa.String(length=255), nullable=False),
        sa.Column('price', sa.Float(), nullable=False),
        sa.Column('img_url', sa.String(length=255), nullable=False),
        sa.Column('category_id', mysql.BIGINT(unsigned=True), nullable=True),
        sa.ForeignKeyConstraint(
            ['category_id'],
            ['category.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
def downgrade():
    op.create_table(
        "gmailauthcredentials",
        sa.Column(
            "created_at",
            mysql.DATETIME(),
            server_default=sa.text("CURRENT_TIMESTAMP"),
            nullable=False,
        ),
        sa.Column("updated_at", mysql.DATETIME(), nullable=False),
        sa.Column("deleted_at", mysql.DATETIME(), nullable=True),
        sa.Column("id", mysql.BIGINT(display_width=20), nullable=False),
        sa.Column(
            "gmailaccount_id",
            mysql.BIGINT(display_width=20),
            autoincrement=False,
            nullable=False,
        ),
        sa.Column(
            "refresh_token_id",
            mysql.BIGINT(display_width=20),
            autoincrement=False,
            nullable=False,
        ),
        sa.Column("scopes", mysql.VARCHAR(length=512), nullable=False),
        sa.Column("g_id_token", mysql.VARCHAR(length=2048), nullable=False),
        sa.Column("client_id", mysql.VARCHAR(length=256), nullable=False),
        sa.Column("client_secret", mysql.VARCHAR(length=256), nullable=False),
        sa.Column(
            "is_valid",
            mysql.TINYINT(display_width=1),
            autoincrement=False,
            nullable=False,
        ),
        sa.ForeignKeyConstraint(
            ["gmailaccount_id"],
            [u"gmailaccount.id"],
            name=u"gmailauthcredentials_ibfk_1",
            ondelete=u"CASCADE",
        ),
        sa.ForeignKeyConstraint(
            ["refresh_token_id"],
            [u"secret.id"],
            name=u"gmailauthcredentials_ibfk_2",
            ondelete=u"CASCADE",
        ),
        sa.PrimaryKeyConstraint("id"),
        mysql_default_charset=u"utf8mb4",
        mysql_engine=u"InnoDB",
    )
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user_resources', sa.Column('resource_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False))
    op.drop_constraint('fk_user_resources_categories', 'user_resources', type_='foreignkey')
    op.create_foreign_key('user_resources_ibfk_1', 'user_resources', 'resources', ['resource_id'], ['id'], onupdate='CASCADE')
    op.drop_column('user_resources', 'category_id')
    op.create_table('resources',
    sa.Column('id', mysql.BIGINT(display_width=20), nullable=False),
    sa.Column('name', mysql.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.drop_table('categories')
Ejemplo n.º 28
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('notes',
    sa.Column('id', mysql.BIGINT(unsigned=True), nullable=False),
    sa.Column('user_id', mysql.BIGINT(unsigned=True), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=True),
    sa.Column('body', sa.Text(), nullable=False),
    sa.Column('created_at', mysql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_notes_created_at'), 'notes', ['created_at'], unique=False)
    op.create_index(op.f('ix_notes_title'), 'notes', ['title'], unique=False)
    op.create_index(op.f('ix_notes_updated_at'), 'notes', ['updated_at'], unique=False)
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('agent_id_permission_id', table_name='agent_permission')
    op.drop_constraint(u'agent_permission_ibfk_2',
                       'agent_permission',
                       type_='foreignkey')
    op.drop_constraint(u'agent_permission_ibfk_1',
                       'agent_permission',
                       type_='foreignkey')
    op.alter_column('agent_permission',
                    'permission_id',
                    existing_type=mysql.BIGINT(display_width=20),
                    nullable=True)
    op.alter_column('agent_permission',
                    'agent_id',
                    existing_type=mysql.INTEGER(display_width=11),
                    nullable=True)
    op.create_index(op.f('ix_permissions_permission'),
                    'permissions', ['permission'],
                    unique=True)
    op.create_foreign_key(u'agent_permission_ibfk_1', 'agent_permission',
                          'tokens', ['agent_id'], ['agent_id'])
    op.create_foreign_key(u'agent_permission_ibfk_2', 'agent_permission',
                          'permissions', ['permission_id'], ['id'])
    op.create_index('agent_id_permission_id',
                    'agent_permission', ['agent_id', 'permission_id'],
                    unique=False)
Ejemplo n.º 30
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('waitlist_entries', 'inviteCount')
    op.create_table('send_invite',
                    sa.Column('sendInviteID',
                              mysql.INTEGER(display_width=11),
                              nullable=False),
                    sa.Column('characterID',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('fleetID',
                              mysql.BIGINT(display_width=20),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('inviteCount',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('sendAt', mysql.DATETIME(), nullable=True),
                    sa.ForeignKeyConstraint(['characterID'],
                                            [u'characters.id'],
                                            name=u'send_invite_ibfk_1'),
                    sa.ForeignKeyConstraint(['fleetID'],
                                            [u'crest_fleets.fleetID'],
                                            name=u'send_invite_ibfk_2'),
                    sa.PrimaryKeyConstraint('sendInviteID'),
                    mysql_default_charset=u'utf8mb4',
                    mysql_engine=u'InnoDB')