def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('schools',
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('fcode_type', sa.Integer(), nullable=True),
    sa.Column('yishuv_symbol', sa.Integer(), nullable=True),
    sa.Column('yishuv_name', sa.Text(), nullable=True),
    sa.Column('school_name', sa.Text(), nullable=True),
    sa.Column('school_latin_name', sa.Text(), nullable=True),
    sa.Column('usg', sa.Integer(), nullable=True),
    sa.Column('usg_code', sa.Integer(), nullable=True),
    sa.Column('e_ord', sa.Float(), nullable=True),
    sa.Column('n_ord', sa.Float(), nullable=True),
    sa.Column('longitude', sa.Float(), nullable=True),
    sa.Column('latitude', sa.Float(), nullable=True),
    sa.Column('geom', geoalchemy2.types.Geometry(geometry_type='POINT', srid=4326), nullable=True),
    sa.Column('data_year', sa.Integer(), nullable=True),
    sa.Column('prdct_ver', sa.DateTime(), nullable=True),
    sa.Column('x', sa.Float(), nullable=True),
    sa.Column('y', sa.Float(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_schools_geom'), 'schools', ['geom'], unique=False)
    op.create_index(op.f('ix_schools_id'), 'schools', ['id'], unique=False)
    op.create_index(op.f('ix_schools_yishuv_symbol'), 'schools', ['yishuv_symbol'], unique=False)
def upgrade():
    campaign_anon_view = table("campaign_anon_view", column("created_at", sa.DateTime), column("datetime", sa.DateTime))
    op.add_column(
        "campaign_anon_view", sa.Column("datetime", sa.DateTime(), nullable=False, server_default=sa.func.now())
    )
    op.execute(campaign_anon_view.update().values(datetime=campaign_anon_view.c.created_at))
    op.alter_column("campaign_anon_view", "datetime", server_default=None)
    op.create_index(op.f("ix_campaign_anon_view_datetime"), "campaign_anon_view", ["datetime"], unique=False)

    campaign_view = table("campaign_view", column("created_at", sa.DateTime), column("datetime", sa.DateTime))
    op.add_column("campaign_view", sa.Column("datetime", sa.DateTime(), nullable=False, server_default=sa.func.now()))
    op.execute(campaign_view.update().values(datetime=campaign_view.c.created_at))
    op.alter_column("campaign_view", "datetime", server_default=None)
    op.create_index(op.f("ix_campaign_view_datetime"), "campaign_view", ["datetime"], unique=False)

    job_impression = table("job_impression", column("created_at", sa.DateTime), column("datetime", sa.DateTime))
    op.add_column("job_impression", sa.Column("datetime", sa.DateTime(), nullable=False, server_default=sa.func.now()))
    op.execute(job_impression.update().values(datetime=job_impression.c.created_at))
    op.alter_column("job_impression", "datetime", server_default=None)
    op.create_index(op.f("ix_job_impression_datetime"), "job_impression", ["datetime"], unique=False)

    job_view_session = table("job_view_session", column("created_at", sa.DateTime), column("datetime", sa.DateTime))
    op.add_column(
        "job_view_session", sa.Column("datetime", sa.DateTime(), nullable=False, server_default=sa.func.now())
    )
    op.execute(job_view_session.update().values(datetime=job_view_session.c.created_at))
    op.alter_column("job_view_session", "datetime", server_default=None)
    op.create_index(op.f("ix_job_view_session_datetime"), "job_view_session", ["datetime"], unique=False)
示例#3
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('default', sa.Boolean(), nullable=True),
    sa.Column('permission', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
    op.create_index(op.f('ix_roles_name'), 'roles', ['name'], unique=True)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.Column('confirmed', sa.Boolean(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('location', sa.String(length=64), nullable=True),
    sa.Column('about_me', sa.Text(), nullable=True),
    sa.Column('member_since', sa.DateTime(), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
示例#4
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'votes', sa.Column('date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.drop_column(u'votes', 'time_stamp')
    op.drop_index(op.f('ix_comments_user_id'), table_name='comments')
    op.drop_index(op.f('ix_comments_site_id'), table_name='comments')
    op.drop_table('comments')
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'messages_drawing_move', sa.Column('special_message_finish_drawing_id', sa.String(length=2000), nullable=True))
    op.add_column(u'messages_drawing_move', sa.Column('special_message_start_drawing_id', sa.String(length=2000), nullable=True))
    op.drop_column(u'messages_drawing_move', 'special_message_id')
    op.create_index(op.f('ix_messages_drawing_move_special_message_finish_drawing_id'), 'messages_drawing_move', ['special_message_finish_drawing_id'], unique=False)
    op.create_index(op.f('ix_messages_drawing_move_special_message_start_drawing_id'), 'messages_drawing_move', ['special_message_start_drawing_id'], unique=False)
def upgrade():
    """ Add next_check and last_check columns to the projects table. """
    op.add_column(
        "projects",
        sa.Column(
            "last_check",
            sa.TIMESTAMP(timezone=True),
            default=arrow.utcnow().datetime,
            server_default=sa.func.current_timestamp(),
        ),
    )

    op.add_column(
        "projects",
        sa.Column(
            "next_check",
            sa.TIMESTAMP(timezone=True),
            default=arrow.utcnow().datetime,
            server_default=sa.func.current_timestamp(),
        ),
    )
    op.create_index(
        op.f("ix_projects_last_check"), "projects", ["last_check"], unique=False
    )
    op.create_index(
        op.f("ix_projects_next_check"), "projects", ["next_check"], unique=False
    )
def upgrade():
    op.create_table('annotation',
        sa.Column('id',
                  types.URLSafeUUID,
                  server_default=sa.func.uuid_generate_v1mc(),
                  primary_key=True),
        sa.Column('created', sa.DateTime, server_default=sa.func.now(), nullable=False),
        sa.Column('updated', sa.DateTime, server_default=sa.func.now(), nullable=False),
        sa.Column('userid', sa.UnicodeText(), nullable=False),
        sa.Column('groupid', sa.UnicodeText(), server_default=u'__world__', nullable=False),
        sa.Column('text', sa.UnicodeText(), nullable=True),
        sa.Column('tags', postgresql.ARRAY(sa.UnicodeText, zero_indexes=True), nullable=True),
        sa.Column('shared', sa.Boolean, server_default=sa.sql.expression.false(), nullable=False),
        sa.Column('target_uri', sa.UnicodeText(), nullable=False),
        sa.Column('target_uri_normalized', sa.UnicodeText(), nullable=False),
        sa.Column('target_selectors',
                  postgresql.JSONB,
                  server_default=sa.func.jsonb('[]'),
                  nullable=True),
        sa.Column('references',
                  postgresql.ARRAY(types.URLSafeUUID),
                  server_default=sa.text('ARRAY[]::uuid[]'),
                  nullable=True),
        sa.Column('extra', postgresql.JSONB, nullable=True),
    )
    op.create_index(op.f('ix__annotation_groupid'), 'annotation', ['groupid'], unique=False)
    op.create_index(op.f('ix__annotation_tags'), 'annotation', ['tags'], postgresql_using='gin', unique=False)
    op.create_index(op.f('ix__annotation_userid'), 'annotation', ['userid'], unique=False)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.Column('date_modified', sa.DateTime(), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('bucketlist',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.Column('date_modified', sa.DateTime(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('creator_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['creator_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_bucketlist_name'), 'bucketlist', ['name'], unique=True)
    op.create_table('bucketitem',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.Column('date_modified', sa.DateTime(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('done', sa.Boolean(), nullable=True),
    sa.Column('bucketlist_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['bucketlist_id'], ['bucketlist.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_bucketitem_name'), 'bucketitem', ['name'], unique=True)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('groups',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('responded', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_groups_email'), 'groups', ['email'], unique=True)
    op.create_index(op.f('ix_groups_name'), 'groups', ['name'], unique=True)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('guests',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('coming', sa.Boolean(), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_guests_name'), 'guests', ['name'], unique=True)
示例#10
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_notification_user_id'), table_name='notification')
    op.drop_index(op.f('ix_notification_read'), table_name='notification')
    op.drop_index(op.f('ix_notification_message'), table_name='notification')
    op.drop_index(op.f('ix_notification_create_at'), table_name='notification')
    op.drop_table('notification')
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('series', 'analytic_context_key')
    op.drop_index('ix_homepath_census_block', table_name='homepath_listing')
    op.drop_index(op.f('ix_craigslist_listing_subdomain'), table_name='craigslist_listing')
    op.create_table('census_block_series',
    sa.Column('state_fp', sa.VARCHAR(length=2), autoincrement=False, nullable=False),
    sa.Column('county_fp', sa.VARCHAR(length=3), autoincrement=False, nullable=False),
    sa.Column('tract_ce', sa.VARCHAR(length=6), autoincrement=False, nullable=False),
    sa.Column('block_ce', sa.VARCHAR(length=1), autoincrement=False, nullable=False),
    sa.Column('series_key', sa.VARCHAR(length=40), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['series_key'], [u'series.key'], name=u'fk_census_block_series_series_key_series'),
    sa.ForeignKeyConstraint(['state_fp', 'county_fp', 'tract_ce', 'block_ce'], [u'census_block.state_fp', u'census_block.county_fp', u'census_block.tract_ce', u'census_block.block_ce'], name=u'fk_census_block_series'),
    sa.PrimaryKeyConstraint('state_fp', 'county_fp', 'tract_ce', 'block_ce', 'series_key', name=u'pk_census_block_series')
    )
    op.create_table('series_segment',
    sa.Column('series_key', sa.VARCHAR(length=40), autoincrement=False, nullable=False),
    sa.Column('dimension_id', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
    sa.Column('segment_id', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['dimension_id', 'segment_id'], [u'segment.dimension_id', u'segment.id'], name=u'fk_series_segment'),
    sa.ForeignKeyConstraint(['dimension_id'], [u'dimension.id'], name=u'fk_series_segment_dimension_id_dimension'),
    sa.ForeignKeyConstraint(['series_key'], [u'series.key'], name=u'fk_series_segment_series_key_series'),
    sa.PrimaryKeyConstraint('series_key', 'dimension_id', 'segment_id', name=u'pk_series_segment')
    )
    op.drop_index('ix_census_block_segment_census_block', table_name='census_block_segment')
    op.drop_table('census_block_segment')
    op.drop_index(op.f('ix_analytic_context_segment_analytic_context_key'), table_name='analytic_context_segment')
    op.drop_index('ix_analytic_context_segment', table_name='analytic_context_segment')
    op.drop_table('analytic_context_segment')
    op.drop_table('analytic_context')

    op.execute(segment.delete(segment.c.dimension_id == 'census_block'))
    op.alter_column('segment', 'sort_value', type_=sa.Unicode(10))
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('farmers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('farmers_name', sa.String(length=64), nullable=True),
    sa.Column('phone_no', sa.Integer(), nullable=True),
    sa.Column('farmers_id_no', sa.Integer(), nullable=True),
    sa.Column('gender', sa.String(), nullable=True),
    sa.Column('location', sa.String(), nullable=True),
    sa.Column('type_of_farming', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('farmers_id_no')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('messages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('to', sa.Integer(), nullable=True),
    sa.Column('message', sa.String(length=64), nullable=True),
    sa.ForeignKeyConstraint(['to'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_messages_message'), 'messages', ['message'], unique=True)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('web_page_history',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('errno', sa.Integer(), nullable=True),
    sa.Column('url', sa.Text(), nullable=False),
    sa.Column('file', sa.Integer(), nullable=True),
    sa.Column('distance', sa.Integer(), nullable=False),
    sa.Column('is_text', sa.Boolean(), nullable=True),
    sa.Column('title', citext.CIText(), nullable=True),
    sa.Column('mimetype', sa.Text(), nullable=True),
    sa.Column('content', sa.Text(), nullable=True),
    sa.Column('fetchtime', sa.DateTime(), nullable=True),
    sa.Column('addtime', sa.DateTime(), nullable=True),
    sa.Column('tsv_content', sqlalchemy_utils.types.ts_vector.TSVectorType(), nullable=True),
    sa.Column('root_rel', sa.Integer(), nullable=False),
    sa.Column('newer_rel', sa.Integer(), nullable=True),
    sa.Column('older_rel', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['file'], ['web_files.id'], ),
    sa.ForeignKeyConstraint(['newer_rel'], ['web_page_history.id'], ),
    sa.ForeignKeyConstraint(['older_rel'], ['web_page_history.id'], ),
    sa.ForeignKeyConstraint(['root_rel'], ['web_pages.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_web_page_history_distance'), 'web_page_history', ['distance'], unique=False)
    op.create_index('ix_web_page_history_tsv_content', 'web_page_history', ['tsv_content'], unique=False, postgresql_using='gin')
    op.create_index(op.f('ix_web_page_history_url'), 'web_page_history', ['url'], unique=True)
示例#14
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('default', sa.Boolean(), nullable=True),
    sa.Column('permissions', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.Column('passwordHash', sa.String(length=128), nullable=True),
    sa.Column('confirmed', sa.Boolean(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('location', sa.String(length=64), nullable=True),
    sa.Column('aboutMe', sa.Text(), nullable=True),
    sa.Column('member_since', sa.DateTime(), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.Column('avatar_hash', sa.String(length=32), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('follows',
    sa.Column('follower_id', sa.Integer(), nullable=False),
    sa.Column('followed_id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['followed_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['follower_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('follower_id', 'followed_id')
    )
    op.create_table('posts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('body_html', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_posts_timestamp'), 'posts', ['timestamp'], unique=False)
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('body_html', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('disabled', sa.Boolean(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_comments_timestamp'), 'comments', ['timestamp'], unique=False)
示例#15
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('publishers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', citext.CIText(), nullable=False),
    sa.Column('site', sa.Text(), nullable=True),
    sa.Column('series', sa.Integer(), nullable=True),
    sa.Column('changetime', sa.DateTime(), nullable=False),
    sa.Column('changeuser', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['changeuser'], ['users.id'], ),
    sa.ForeignKeyConstraint(['series'], ['series.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('series', 'name')
    )
    op.create_index(op.f('ix_publishers_changetime'), 'publishers', ['changetime'], unique=False)
    op.create_index(op.f('ix_publishers_changeuser'), 'publishers', ['changeuser'], unique=False)
    op.create_table('publisherschanges',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', citext.CIText(), nullable=False),
    sa.Column('site', sa.Text(), nullable=True),
    sa.Column('operation', sa.Text(), nullable=True),
    sa.Column('srccol', sa.Integer(), nullable=True),
    sa.Column('series', sa.Integer(), nullable=True),
    sa.Column('changetime', sa.DateTime(), nullable=False),
    sa.Column('changeuser', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['changeuser'], ['users.id'], ),
    sa.ForeignKeyConstraint(['series'], ['series.id'], ),
    sa.ForeignKeyConstraint(['srccol'], ['publishers.id'], ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('id'),
    )
    op.create_index(op.f('ix_publisherschanges_changetime'), 'publisherschanges', ['changetime'], unique=False)
    op.create_index(op.f('ix_publisherschanges_changeuser'), 'publisherschanges', ['changeuser'], unique=False)
    op.create_index(op.f('ix_publisherschanges_srccol'), 'publisherschanges', ['srccol'], unique=False)
示例#16
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    op.drop_index(op.f('ix_roles_default'), table_name='roles')
    op.drop_table('roles')
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('source',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=False),
    sa.Column('description', sa.String(length=250), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('compound',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('external_id', sa.String(), nullable=False),
    sa.Column('source_id', sa.Integer(), nullable=False),
    sa.Column('smiles', sa.String(length=750), nullable=False),
    sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_index(op.f('ix_compound_external_id'), 'compound', ['external_id'], unique=True)
    op.create_table('species',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('external_id', sa.Integer(), nullable=False),
    sa.Column('source_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=150), nullable=False),
    sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_index(op.f('ix_species_external_id'), 'species', ['external_id'], unique=True)
    op.create_table('target',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('external_id', sa.String(), nullable=False),
    sa.Column('source_id', sa.Integer(), nullable=False),
    sa.Column('species_id', sa.Integer(), nullable=False),
    sa.Column('sequence', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
    sa.ForeignKeyConstraint(['species_id'], ['species.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_index(op.f('ix_target_external_id'), 'target', ['external_id'], unique=True)
    op.create_table('activity',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('external_id', sa.String(), nullable=False),
    sa.Column('source_id', sa.Integer(), nullable=False),
    sa.Column('relation', sa.Enum('=', '>', '<', '<=', '>=', name='relation'), nullable=False),
    sa.Column('value', sa.Float(), nullable=False),
    sa.Column('assay_type', sa.Enum('ADMET', 'Binding', 'Functional', 'Property', 'Unassigned', name='assay_type'), nullable=False),
    sa.Column('activity_type', sa.Enum('Kd', 'AC50', 'Potency', 'XC50', 'IC50', 'Ki', 'EC50', name='activity_type'), nullable=False),
    sa.Column('confidence_score', sa.Integer(), nullable=True),
    sa.Column('target_id', sa.Integer(), nullable=False),
    sa.Column('compound_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['compound_id'], ['compound.id'], ),
    sa.ForeignKeyConstraint(['source_id'], ['source.id'], ),
    sa.ForeignKeyConstraint(['target_id'], ['target.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_index(op.f('ix_activity_confidence_score'), 'activity', ['confidence_score'], unique=False)
示例#18
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_defect_kind'), table_name='defect')
    op.drop_table('defect')
    op.drop_table('story')
    op.drop_index(op.f('ix_project_name'), table_name='project')
    op.drop_table('project')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chat',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=True),
    sa.Column('password', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('message',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('datetime', sa.DateTime(), nullable=True),
    sa.Column('chat', sa.Integer(), nullable=False),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('message', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['chat'], ['chat.id'], initially='DEFERRED', deferrable=True),
    sa.ForeignKeyConstraint(['user'], ['user.id'], initially='DEFERRED', deferrable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user_chat',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('chat', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['chat'], ['chat.id'], initially='DEFERRED', deferrable=True),
    sa.ForeignKeyConstraint(['user'], ['user.id'], initially='DEFERRED', deferrable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user', 'chat')
    )
    op.create_index(op.f('ix_user_chat_chat'), 'user_chat', ['chat'], unique=False)
    op.create_index(op.f('ix_user_chat_user'), 'user_chat', ['user'], unique=False)
示例#20
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('users')
    op.drop_index(op.f('ix_records_qq'), table_name='records')
    op.drop_index(op.f('ix_records_phone'), table_name='records')
    op.drop_index(op.f('ix_records_email'), table_name='records')
    op.drop_table('records')
示例#21
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('project',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_project_name'), 'project', ['name'], unique=False)
    op.create_table('story',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('text', sa.Text(), nullable=True),
    sa.Column('role', sa.Text(), nullable=True),
    sa.Column('means', sa.Text(), nullable=True),
    sa.Column('ends', sa.Text(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('defect',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('highlight', sa.Text(), nullable=False),
    sa.Column('kind', sa.String(length=120), nullable=False),
    sa.Column('subkind', sa.String(length=120), nullable=False),
    sa.Column('severity', sa.String(length=120), nullable=False),
    sa.Column('story_id', sa.Integer(), nullable=False),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['story_id'], ['story.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_defect_kind'), 'defect', ['kind'], unique=False)
def downgrade():
	op.create_index('ix_tbt_book_course_code', 'tbt_book_course', ['code'], unique=False)
	op.drop_index('tbt_book_course_code_revidx', table_name='tbt_book_course')
	op.drop_index('tbt_book_course_code_idx', table_name='tbt_book_course')
	op.drop_index(op.f('ix_tbt_book_seller'), table_name='tbt_book')
	op.drop_index(op.f('ix_tbt_book_buyer'), table_name='tbt_book')
	op.drop_index('banner_time', table_name='banner')
示例#23
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('first', sa.String(length=32), nullable=False),
    sa.Column('last', sa.String(length=32), nullable=False),
    sa.Column('email', sa.String(length=128), nullable=False),
    sa.Column('salt', sa.String(), nullable=False),
    sa.Column('password', sa.String(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('NOW()'), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False)
    op.create_table('posts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('body', sa.String(length=256), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_posts_id'), 'posts', ['id'], unique=False)
    op.create_table('replies',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('NOW()'), nullable=False),
    sa.Column('body', sa.String(length=256), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_replies_id'), 'replies', ['id'], unique=False)
示例#24
0
def upgrade():
    op.create_table('notification',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('event', sa.String(length=255), nullable=False),
    sa.Column('channels', postgresql.ARRAY(sa.String(length=255)), nullable=True),
    sa.Column('params', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.Column('actor_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['actor_id'], ['role.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_notification_channels'), 'notification', ['channels'], unique=False)
    op.create_table('subscription',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.Column('channel', sa.String(length=255), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_subscription_channel'), 'subscription', ['channel'], unique=False)
    op.create_index(op.f('ix_subscription_role_id'), 'subscription', ['role_id'], unique=False)
示例#25
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_selector_text'), table_name='selector')
    op.drop_index(op.f('ix_selector_normalized'), table_name='selector')
    op.drop_table('selector')
    op.drop_table('source_user')
    op.drop_table('alert')
示例#26
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chats',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('chatname', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_chats_chatname'), 'chats', ['chatname'], unique=False)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=False),
    sa.Column('password_hash', sa.String(length=128), nullable=False),
    sa.Column('confirmed', sa.Boolean(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('messages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('userid', sa.Integer(), nullable=False),
    sa.Column('chatid', sa.Integer(), nullable=False),
    sa.Column('text', sa.String(length=999), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['chatid'], ['chats.id'], ),
    sa.ForeignKeyConstraint(['userid'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_messages_text'), 'messages', ['text'], unique=False)
    op.create_index(op.f('ix_messages_timestamp'), 'messages', ['timestamp'], unique=False)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('category_opportunity_association',
    sa.Column('category_id', sa.Integer(), nullable=True),
    sa.Column('opportunity_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['category_id'], ['category.id'], ondelete='SET NULL'),
    sa.ForeignKeyConstraint(['opportunity_id'], ['opportunity.id'], ondelete='SET NULL')
    )
    op.create_index(op.f('ix_category_opportunity_association_category_id'), 'category_opportunity_association', ['category_id'], unique=False)
    op.create_index(op.f('ix_category_opportunity_association_opportunity_id'), 'category_opportunity_association', ['opportunity_id'], unique=False)
    op.create_table('document',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('display_name', sa.String(length=255), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('form_href', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_documents_id'), 'document', ['id'], unique=False)
    op.add_column(u'opportunity', sa.Column('contact_id', sa.Integer(), nullable=False))
    op.add_column(u'opportunity', sa.Column('planned_deadline', sa.DateTime(), nullable=True))
    op.add_column(u'opportunity', sa.Column('planned_open', sa.DateTime(), nullable=True))
    op.add_column(u'opportunity', sa.Column('created_by', sa.Integer(), nullable=False))
    op.add_column(u'opportunity', sa.Column('document', sa.String(length=255), nullable=True))
    op.add_column(u'opportunity', sa.Column('document_href', sa.String(length=255), nullable=True))
    op.add_column(u'opportunity', sa.Column('created_from_id', sa.Integer(), nullable=True))
    op.add_column(u'opportunity', sa.Column('is_public', sa.Boolean(), nullable=True))
    op.add_column(u'opportunity', sa.Column('documents_needed', postgresql.ARRAY(sa.Integer()), nullable=True))
    op.create_foreign_key('opportunity_created_by_user_id_fkey', 'opportunity', 'users', ['created_by'], ['id'])
    op.drop_constraint(u'opportunity_category_id_fkey', 'opportunity', type_='foreignkey')
    op.create_foreign_key('opportunity_user_id_fkey', 'opportunity', 'users', ['contact_id'], ['id'])
    op.drop_column(u'opportunity', 'category_id')
    op.drop_column(u'opportunity', 'bid_open')
    op.drop_column(u'opportunity', 'contract_id')
def upgrade():
	op.create_index('banner_time', 'banner', ['added', 'removed'], unique=False)
	op.create_index(op.f('ix_tbt_book_buyer'), 'tbt_book', ['buyer'], unique=False)
	op.create_index(op.f('ix_tbt_book_seller'), 'tbt_book', ['seller'], unique=False)
	op.create_index('tbt_book_course_code_idx', 'tbt_book_course', ['code', 'bookid'], unique=False)
	op.create_index('tbt_book_course_code_revidx', 'tbt_book_course', ['bookid', 'code'], unique=False)
	op.drop_index('ix_tbt_book_course_code', table_name='tbt_book_course')
示例#29
0
def upgrade():
    op.create_table('processing_log', # noqa
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.BigInteger(), nullable=False),
        sa.Column('operation', sa.Unicode(), nullable=True),
        sa.Column('component', sa.Unicode(), nullable=True),
        sa.Column('source_location', sa.Unicode(), nullable=True),
        sa.Column('content_hash', sa.Unicode(length=65), nullable=True),
        sa.Column('foreign_id', sa.Unicode(), nullable=True),
        sa.Column('source_id', sa.Integer(), nullable=True),
        sa.Column('document_id', sa.BigInteger(), nullable=True),
        sa.Column('meta', postgresql.JSONB(), nullable=True),
        sa.Column('error_type', sa.Unicode(), nullable=True),
        sa.Column('error_message', sa.Unicode(), nullable=True),
        sa.Column('error_details', sa.Unicode(), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_processing_log_component'), 'processing_log',
                    ['component'], unique=False)
    op.create_index(op.f('ix_processing_log_content_hash'), 'processing_log',
                    ['content_hash'], unique=False)
    op.create_index(op.f('ix_processing_log_operation'), 'processing_log',
                    ['operation'], unique=False)
    op.create_index(op.f('ix_processing_log_source_loc'), 'processing_log',
                    ['source_location'], unique=False)
示例#30
0
def upgrade():
    op.create_table('mantisbugs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('summary', sa.String(length=256), nullable=False),
    sa.Column('status', sa.Enum('NEW', 'ASSIGNED', 'MODIFIED', 'ON_QA', 'VERIFIED', 'RELEASE_PENDING', 'ON_DEV', 'POST', 'CLOSED', name='mantisbug_status'), nullable=False),
    sa.Column('resolution', sa.Enum('NOTABUG', 'WONTFIX', 'WORKSFORME', 'DEFERRED', 'CURRENTRELEASE', 'RAWHIDE', 'ERRATA', 'DUPLICATE', 'UPSTREAM', 'NEXTRELEASE', 'CANTFIX', 'INSUFFICIENT_DATA', name='mantisbug_resolution'), nullable=True),
    sa.Column('duplicate_id', sa.Integer(), nullable=True),
    sa.Column('creation_time', sa.DateTime(), nullable=False),
    sa.Column('last_change_time', sa.DateTime(), nullable=False),
    sa.Column('external_id', sa.Integer(), nullable=False),
    sa.Column('tracker_id', sa.Integer(), nullable=False),
    sa.Column('opsysrelease_id', sa.Integer(), nullable=False),
    sa.Column('component_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['component_id'], ['opsyscomponents.id'], ),
    sa.ForeignKeyConstraint(['duplicate_id'], ['mantisbugs.id'], ),
    sa.ForeignKeyConstraint(['opsysrelease_id'], ['opsysreleases.id'], ),
    sa.ForeignKeyConstraint(['tracker_id'], ['bugtrackers.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('external_id', 'tracker_id')
    )
    op.create_index(op.f('ix_mantisbugs_component_id'), 'mantisbugs', ['component_id'], unique=False)
    op.create_index(op.f('ix_mantisbugs_duplicate_id'), 'mantisbugs', ['duplicate_id'], unique=False)
    op.create_index(op.f('ix_mantisbugs_opsysrelease_id'), 'mantisbugs', ['opsysrelease_id'], unique=False)
    op.create_table('reportmantis',
    sa.Column('report_id', sa.Integer(), nullable=False),
    sa.Column('mantisbug_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['mantisbug_id'], ['mantisbugs.id'], ),
    sa.ForeignKeyConstraint(['report_id'], ['reports.id'], ),
    sa.PrimaryKeyConstraint('report_id', 'mantisbug_id'),
    )
示例#31
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('ih_area_info',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=32), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('ih_facility_info',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=32), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'ih_user_profile',
        sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=32), nullable=False),
        sa.Column('password_hash', sa.String(length=128), nullable=False),
        sa.Column('mobile', sa.String(length=11), nullable=False),
        sa.Column('real_name', sa.String(length=32), nullable=True),
        sa.Column('id_card', sa.String(length=20), nullable=True),
        sa.Column('avatar_url', sa.String(length=128), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('mobile'),
        sa.UniqueConstraint('name'))
    op.create_table(
        'ih_house_info', sa.Column('create_time', sa.DateTime(),
                                   nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('area_id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=64), nullable=False),
        sa.Column('price', sa.Integer(), nullable=True),
        sa.Column('address', sa.String(length=512), nullable=True),
        sa.Column('room_count', sa.Integer(), nullable=True),
        sa.Column('acreage', sa.Integer(), nullable=True),
        sa.Column('unit', sa.String(length=32), nullable=True),
        sa.Column('capacity', sa.Integer(), nullable=True),
        sa.Column('beds', sa.String(length=64), nullable=True),
        sa.Column('deposit', sa.Integer(), nullable=True),
        sa.Column('min_days', sa.Integer(), nullable=True),
        sa.Column('max_days', sa.Integer(), nullable=True),
        sa.Column('order_count', sa.Integer(), nullable=True),
        sa.Column('index_image_url', sa.String(length=256), nullable=True),
        sa.ForeignKeyConstraint(
            ['area_id'],
            ['ih_area_info.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['ih_user_profile.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'ih_house_facility', sa.Column('house_id',
                                       sa.Integer(),
                                       nullable=False),
        sa.Column('facility_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['facility_id'],
            ['ih_facility_info.id'],
        ), sa.ForeignKeyConstraint(
            ['house_id'],
            ['ih_house_info.id'],
        ), sa.PrimaryKeyConstraint('house_id', 'facility_id'))
    op.create_table(
        'ih_house_image', sa.Column('create_time',
                                    sa.DateTime(),
                                    nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('house_id', sa.Integer(), nullable=False),
        sa.Column('url', sa.String(length=256), nullable=False),
        sa.ForeignKeyConstraint(
            ['house_id'],
            ['ih_house_info.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'ih_order_info', sa.Column('create_time', sa.DateTime(),
                                   nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('house_id', sa.Integer(), nullable=False),
        sa.Column('begin_date', sa.DateTime(), nullable=False),
        sa.Column('end_date', sa.DateTime(), nullable=False),
        sa.Column('days', sa.Integer(), nullable=False),
        sa.Column('house_price', sa.Integer(), nullable=False),
        sa.Column('amount', sa.Integer(), nullable=False),
        sa.Column('status',
                  sa.Enum('WAIT_ACCEPT', 'WAIT_PAYMENT', 'PAID',
                          'WAIT_COMMENT', 'COMPLETE', 'CANCELED', 'REJECTED'),
                  nullable=True), sa.Column('comment',
                                            sa.Text(),
                                            nullable=True),
        sa.ForeignKeyConstraint(
            ['house_id'],
            ['ih_house_info.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['ih_user_profile.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_ih_order_info_status'),
                    'ih_order_info', ['status'],
                    unique=False)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_videos_video_url'), table_name='videos')
    op.drop_table('videos')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
示例#34
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_post_timestamp'), table_name='post')
    op.drop_table('post')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "kronos_gateway",
        sa.Column("hid", sa.Text(), nullable=False),
        sa.Column("name", sa.Text(), nullable=False),
        sa.Column("uid", sa.Text(), nullable=False),
        sa.Column("osName", sa.Text(), nullable=False),
        sa.Column("type", sa.Text(), nullable=False),
        sa.Column("softwareName", sa.Text(), nullable=False),
        sa.Column("softwareVersion", sa.Text(), nullable=False),
        sa.Column("sdkVersion", sa.Text(), nullable=False),
        sa.Column("discoveredAt", sa.Integer(), nullable=False),
        sa.PrimaryKeyConstraint("hid"),
    )
    op.create_index(op.f("ix_kronos_gateway_hid"),
                    "kronos_gateway", ["hid"],
                    unique=False)
    op.create_table(
        "kronos_device",
        sa.Column("hid", sa.Text(), nullable=False),
        sa.Column("name", sa.Text(), nullable=False),
        sa.Column("uid", sa.Text(), nullable=False),
        sa.Column("type", sa.Text(), nullable=False),
        sa.Column("gatewayHid", sa.Text(), nullable=False),
        sa.Column("softwareName", sa.Text(), nullable=False),
        sa.Column("softwareVersion", sa.Text(), nullable=False),
        sa.Column("discoveredAt", sa.Integer(), nullable=False),
        sa.Column("lastPingedAt", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["gatewayHid"],
            ["kronos_gateway.hid"],
        ),
        sa.PrimaryKeyConstraint("hid"),
    )
    op.create_index(op.f("ix_kronos_device_hid"),
                    "kronos_device", ["hid"],
                    unique=False)
    op.create_table(
        "feeding_event",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("timestamp", sa.Integer(), nullable=False),
        sa.Column("device_hid", sa.Text(), nullable=False),
        sa.ForeignKeyConstraint(
            ["device_hid"],
            ["kronos_device.hid"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "feeding_schedule",
        sa.Column("device_hid", sa.Text(), nullable=False),
        sa.Column("time", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ["device_hid"],
            ["kronos_device.hid"],
        ),
        sa.PrimaryKeyConstraint("device_hid", "time"),
    )
    op.create_table(
        "kronos_device_sensors",
        sa.Column("device_hid", sa.Text(), nullable=False),
        sa.Column("timestamp", sa.Integer(), nullable=False),
        sa.Column("voltage", sa.Float(), nullable=False),
        sa.Column("usb_power", sa.Boolean(), nullable=False),
        sa.Column("charging", sa.Boolean(), nullable=False),
        sa.Column("ir", sa.Boolean(), nullable=False),
        sa.Column("rssi", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ["device_hid"],
            ["kronos_device.hid"],
        ),
        sa.PrimaryKeyConstraint("device_hid"),
    )
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_authy_id'), table_name='user')
    op.drop_column('user', 'authy_id')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('authy_id', sa.Integer(), nullable=True))
    op.create_index(op.f('ix_user_authy_id'), 'user', ['authy_id'], unique=True)
示例#38
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_roles_default'), table_name='roles')
    op.drop_column('roles', 'permissions')
    op.drop_column('roles', 'default')
示例#39
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('area', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.Column('ancestor_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['ancestor_id'],
                        ['area.id'],
                    ), sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name'))
    op.create_table('concept', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table('document_type',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table('role', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.Column('default', sa.Boolean(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_index(op.f('ix_role_default'), 'role', ['default'], unique=False)
    op.create_table('state', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table('workflow', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'index', sa.Column('workflow_id', sa.Integer(), nullable=False),
        sa.Column('state_id', sa.Integer(), nullable=True),
        sa.Column('index', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['state_id'],
            ['state.id'],
        ), sa.ForeignKeyConstraint(
            ['workflow_id'],
            ['workflow.id'],
        ), sa.PrimaryKeyConstraint('workflow_id', 'index'))
    op.create_table(
        'region', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('workflow_employee_id', sa.Integer(), nullable=True),
        sa.Column('workflow_student_id', sa.Integer(), nullable=True),
        sa.Column('workflow_teacher_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['workflow_employee_id'],
            ['workflow.id'],
        ), sa.ForeignKeyConstraint(
            ['workflow_student_id'],
            ['workflow.id'],
        ), sa.ForeignKeyConstraint(
            ['workflow_teacher_id'],
            ['workflow.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table(
        'state_document_type_checked',
        sa.Column('state_id', sa.Integer(), nullable=False),
        sa.Column('document_type_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['document_type_id'],
            ['document_type.id'],
        ), sa.ForeignKeyConstraint(
            ['state_id'],
            ['state.id'],
        ), sa.PrimaryKeyConstraint('state_id', 'document_type_id'))
    op.create_table(
        'state_document_type_uploaded',
        sa.Column('state_id', sa.Integer(), nullable=False),
        sa.Column('document_type_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['document_type_id'],
            ['document_type.id'],
        ), sa.ForeignKeyConstraint(
            ['state_id'],
            ['state.id'],
        ), sa.PrimaryKeyConstraint('state_id', 'document_type_id'))
    op.create_table('state_role',
                    sa.Column('state_id', sa.Integer(), nullable=False),
                    sa.Column('role_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['role_id'],
                        ['role.id'],
                    ), sa.ForeignKeyConstraint(
                        ['state_id'],
                        ['state.id'],
                    ), sa.PrimaryKeyConstraint('state_id', 'role_id'))
    op.create_table(
        'state_workflow', sa.Column('state_id', sa.Integer(), nullable=False),
        sa.Column('workflow_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['state_id'],
            ['state.id'],
        ), sa.ForeignKeyConstraint(
            ['workflow_id'],
            ['workflow.id'],
        ), sa.PrimaryKeyConstraint('state_id', 'workflow_id'))
    op.create_table(
        'user', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=64), nullable=False),
        sa.Column('email', sa.String(length=64), nullable=False),
        sa.Column('password_hash', sa.String(length=128), nullable=False),
        sa.Column('firstname', sa.String(length=64), nullable=True),
        sa.Column('lastname', sa.String(length=64), nullable=True),
        sa.Column('category', sa.String(length=64), nullable=False),
        sa.Column('confirmed', sa.Boolean(), nullable=True),
        sa.Column('activated', sa.Boolean(), nullable=True),
        sa.Column('area_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['area_id'],
            ['area.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'),
        sa.UniqueConstraint('username'))
    op.create_index(op.f('ix_user_activated'),
                    'user', ['activated'],
                    unique=False)
    op.create_index(op.f('ix_user_confirmed'),
                    'user', ['confirmed'],
                    unique=False)
    op.create_table('country', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.Column('region_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['region_id'],
                        ['region.id'],
                    ), sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name'))
    op.create_table('user_role',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('role_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['role_id'],
                        ['role.id'],
                    ), sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('user_id', 'role_id'))
    op.create_table(
        'travel', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('departure_date', sa.Date(), nullable=False),
        sa.Column('duration', sa.Integer(), nullable=False),
        sa.Column('justification', sa.Text(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('concept_id', sa.Integer(), nullable=True),
        sa.Column('country_id', sa.Integer(), nullable=True),
        sa.Column('state_id', sa.Integer(), nullable=True),
        sa.Column('workflow_id', sa.Integer(), nullable=True),
        sa.Column('accepted', sa.Boolean(), nullable=True),
        sa.Column('rejected', sa.Boolean(), nullable=True),
        sa.Column('cancelled', sa.Boolean(), nullable=True),
        sa.Column('confirmed_in_state', sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(
            ['concept_id'],
            ['concept.id'],
        ), sa.ForeignKeyConstraint(
            ['country_id'],
            ['country.id'],
        ), sa.ForeignKeyConstraint(
            ['state_id'],
            ['state.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.ForeignKeyConstraint(
            ['workflow_id'],
            ['workflow.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_travel_accepted'),
                    'travel', ['accepted'],
                    unique=False)
    op.create_index(op.f('ix_travel_cancelled'),
                    'travel', ['cancelled'],
                    unique=False)
    op.create_index(op.f('ix_travel_confirmed_in_state'),
                    'travel', ['confirmed_in_state'],
                    unique=False)
    op.create_index(op.f('ix_travel_rejected'),
                    'travel', ['rejected'],
                    unique=False)
    op.create_table('comment', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('text', sa.Text(), nullable=False),
                    sa.Column('travel_id', sa.Integer(), nullable=True),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['travel_id'],
                        ['travel.id'],
                    ), sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'document', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=False),
        sa.Column('confirmed', sa.Boolean(), nullable=True),
        sa.Column('upload_by_node', sa.Boolean(), nullable=True),
        sa.Column('document_type_id', sa.Integer(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('travel_id', sa.Integer(), nullable=True),
        sa.Column('type', sa.String(length=64), nullable=True),
        sa.Column('text', sa.Text(), nullable=True),
        sa.Column('pdf_path', sa.String(length=256), nullable=True),
        sa.Column('image_path', sa.String(length=256), nullable=True),
        sa.Column('path', sa.String(length=256), nullable=True),
        sa.ForeignKeyConstraint(
            ['document_type_id'],
            ['document_type.id'],
        ), sa.ForeignKeyConstraint(
            ['travel_id'],
            ['travel.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('image_path'),
        sa.UniqueConstraint('path'), sa.UniqueConstraint('pdf_path'))
    op.create_index(op.f('ix_document_confirmed'),
                    'document', ['confirmed'],
                    unique=False)
    op.create_index(op.f('ix_document_type'),
                    'document', ['type'],
                    unique=False)
    op.create_index(op.f('ix_document_upload_by_node'),
                    'document', ['upload_by_node'],
                    unique=False)
示例#40
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_pitches_description'), table_name='pitches')
    op.drop_table('pitches')
示例#41
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_requests_name_search'), table_name='requests')
    op.drop_column('requests', 'name_search')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_companies_symbol'), table_name='companies')
    op.drop_index(op.f('ix_companies_name'), table_name='companies')
    op.drop_table('companies')
def upgrade():
    op.create_table(
        'quark_mac_address_ranges',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('cidr', sa.String(length=255), nullable=False),
        sa.Column('first_address', sa.BigInteger(), nullable=False),
        sa.Column('last_address', sa.BigInteger(), nullable=False),
        sa.Column('next_auto_assign_mac', sa.BigInteger(), nullable=False),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_tag_associations',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('discriminator', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_ip_policy',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('description', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_security_groups',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=False),
        sa.Column('description', sa.String(length=255), nullable=False),
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_security_groups_tenant_id'),
        'quark_security_groups',
        ['tenant_id'],
        unique=False)
    op.create_table(
        'quark_tags',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('association_uuid', sa.String(length=36), nullable=False),
        sa.Column('tag', sa.String(length=255), nullable=False),
        sa.ForeignKeyConstraint(['association_uuid'],
                                [u'quark_tag_associations.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_security_group_rule',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('group_id', sa.String(length=36), nullable=False),
        sa.Column('direction', sa.String(length=10), nullable=False),
        sa.Column('ethertype', sa.String(length=4), nullable=False),
        sa.Column('port_range_max', sa.Integer(), nullable=True),
        sa.Column('port_range_min', sa.Integer(), nullable=True),
        sa.Column('protocol', sa.Integer(), nullable=True),
        sa.Column('remote_ip_prefix', sa.String(length=22), nullable=True),
        sa.Column('remote_group_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['group_id'], ['quark_security_groups.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_mac_addresses',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('address', sa.BigInteger(), nullable=False),
        sa.Column('mac_address_range_id', sa.String(length=36),
                  nullable=False),
        sa.Column('deallocated', sa.Boolean(), nullable=True),
        sa.Column('deallocated_at', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(['mac_address_range_id'],
                                ['quark_mac_address_ranges.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('address'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_mac_addresses_deallocated_at'),
        'quark_mac_addresses',
        ['deallocated_at'],
        unique=False)
    op.create_table(
        'quark_ip_policy_cidrs',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('ip_policy_id', sa.String(length=36), nullable=True),
        sa.Column('cidr', sa.String(length=64), nullable=True),
        sa.ForeignKeyConstraint(['ip_policy_id'],
                                ['quark_ip_policy.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_networks',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('ip_policy_id', sa.String(length=36), nullable=True),
        sa.Column('network_plugin', sa.String(length=36), nullable=True),
        sa.Column('ipam_strategy', sa.String(length=255), nullable=True),
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.ForeignKeyConstraint(['ip_policy_id'], ['quark_ip_policy.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(op.f('ix_quark_networks_tenant_id'),
                    'quark_networks',
                    ['tenant_id'],
                    unique=False)
    op.create_table(
        'quark_ports',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('admin_state_up', sa.Boolean(), nullable=True),
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.Column('backend_key', sa.String(length=36), nullable=False),
        sa.Column('mac_address', sa.BigInteger(), nullable=True),
        sa.Column('device_id', sa.String(length=255), nullable=False),
        sa.Column('device_owner', sa.String(length=255), nullable=True),
        sa.Column('bridge', sa.String(length=255), nullable=True),
        sa.ForeignKeyConstraint(['network_id'], ['quark_networks.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index('idx_ports_1',
                    'quark_ports',
                    ['device_id', 'tenant_id'],
                    unique=False)
    op.create_index('idx_ports_2',
                    'quark_ports',
                    ['device_owner', 'network_id'],
                    unique=False)
    op.create_index('idx_ports_3', 'quark_ports', ['tenant_id'], unique=False)
    op.create_index(op.f('ix_quark_ports_device_id'),
                    'quark_ports',
                    ['device_id'],
                    unique=False)
    op.create_index(op.f('ix_quark_ports_name'), 'quark_ports', ['name'],
                    unique=False)
    op.create_table(
        'quark_subnets',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.Column('_cidr', sa.String(length=64), nullable=False),
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('segment_id', sa.String(length=255), nullable=True),
        sa.Column('first_ip', INET(), nullable=True),
        sa.Column('last_ip', INET(), nullable=True),
        sa.Column('ip_version', sa.Integer(), nullable=True),
        sa.Column('next_auto_assign_ip', INET(), nullable=True),
        sa.Column('enable_dhcp', sa.Boolean(), nullable=True),
        sa.Column('ip_policy_id', sa.String(length=36), nullable=True),
        sa.Column('do_not_use', sa.Boolean(), nullable=True),
        sa.Column('tag_association_uuid', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['ip_policy_id'], ['quark_ip_policy.id'], ),
        sa.ForeignKeyConstraint(['network_id'], ['quark_networks.id'], ),
        sa.ForeignKeyConstraint(['tag_association_uuid'],
                                [u'quark_tag_associations.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_subnets_segment_id'),
        'quark_subnets',
        ['segment_id'],
        unique=False)
    op.create_index(
        op.f('ix_quark_subnets_tenant_id'),
        'quark_subnets',
        ['tenant_id'],
        unique=False)
    op.create_table(
        'quark_routes',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('cidr', sa.String(length=64), nullable=True),
        sa.Column('gateway', sa.String(length=64), nullable=True),
        sa.Column('subnet_id', sa.String(length=36), nullable=True),
        sa.Column('tag_association_uuid', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['subnet_id'], ['quark_subnets.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['tag_association_uuid'],
                                [u'quark_tag_associations.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_port_security_group_associations',
        sa.Column('port_id', sa.String(length=36), nullable=True),
        sa.Column('group_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['group_id'], ['quark_security_groups.id'], ),
        sa.ForeignKeyConstraint(['port_id'], ['quark_ports.id'], ),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_ip_addresses',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('address_readable', sa.String(length=128), nullable=False),
        sa.Column('address', INET(), nullable=False),
        sa.Column('subnet_id', sa.String(length=36), nullable=True),
        sa.Column('network_id', sa.String(length=36), nullable=True),
        sa.Column('version', sa.Integer(), nullable=True),
        sa.Column('allocated_at', sa.DateTime(), nullable=True),
        sa.Column('_deallocated', sa.Boolean(), nullable=True),
        sa.Column('used_by_tenant_id', sa.String(length=255), nullable=True),
        sa.Column('deallocated_at', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(['network_id'], ['quark_networks.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['subnet_id'], ['quark_subnets.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('subnet_id', 'address', name='subnet_id_address'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_ip_addresses_address'),
        'quark_ip_addresses',
        ['address'],
        unique=False)
    op.create_index(
        op.f('ix_quark_ip_addresses_deallocated_at'),
        'quark_ip_addresses',
        ['deallocated_at'],
        unique=False)
    op.create_index(
        op.f('ix_quark_ip_addresses_version'),
        'quark_ip_addresses',
        ['version'],
        unique=False)
    op.create_table(
        'quark_dns_nameservers',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('ip', INET(), nullable=True),
        sa.Column('subnet_id', sa.String(length=36), nullable=True),
        sa.Column('tag_association_uuid', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['subnet_id'], ['quark_subnets.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['tag_association_uuid'],
                                [u'quark_tag_associations.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_port_ip_address_associations',
        sa.Column('port_id', sa.String(length=36), nullable=True),
        sa.Column('ip_address_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['ip_address_id'], ['quark_ip_addresses.id'],),
        sa.ForeignKeyConstraint(['port_id'], ['quark_ports.id'], ),
        mysql_engine='InnoDB')
    op.create_table(
        'quark_nvp_driver_qos',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('display_name', sa.String(length=255), nullable=False),
        sa.Column('max_bandwidth_rate', sa.Integer(), nullable=False),
        sa.Column('min_bandwidth_rate', sa.Integer(), nullable=False),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_table(
        'quotas',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('resource', sa.String(length=255), nullable=True),
        sa.Column('limit', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quotas_tenant_id'),
        'quotas',
        ['tenant_id'],
        unique=False)
    op.create_table(
        'quark_nvp_driver_lswitch',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('nvp_id', sa.String(length=36), nullable=False),
        sa.Column('network_id', sa.String(length=36), nullable=False),
        sa.Column('display_name', sa.String(length=255), nullable=True),
        sa.Column('port_count', sa.Integer(), nullable=True),
        sa.Column('transport_zone', sa.String(length=36), nullable=True),
        sa.Column('transport_connector', sa.String(length=20), nullable=True),
        sa.Column('segment_id', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_nvp_driver_lswitch_network_id'),
        'quark_nvp_driver_lswitch',
        ['network_id'],
        unique=False)
    op.create_index(
        op.f('ix_quark_nvp_driver_lswitch_nvp_id'),
        'quark_nvp_driver_lswitch',
        ['nvp_id'],
        unique=False)
    op.create_table(
        'quark_nvp_driver_security_profile',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('nvp_id', sa.String(length=36), nullable=False),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_nvp_driver_security_profile_nvp_id'),
        'quark_nvp_driver_security_profile',
        ['nvp_id'],
        unique=False)
    op.create_table(
        'quark_nvp_driver_lswitchport',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('port_id', sa.String(length=36), nullable=False),
        sa.Column('switch_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['switch_id'],
                                ['quark_nvp_driver_lswitch.id'], ),
        sa.PrimaryKeyConstraint('id'),
        mysql_engine='InnoDB')
    op.create_index(
        op.f('ix_quark_nvp_driver_lswitchport_port_id'),
        'quark_nvp_driver_lswitchport',
        ['port_id'],
        unique=False)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('logins')
    op.drop_table('cards')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_table('users')
示例#45
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_crash_location_point_timestamp'),
                  table_name='crash_location_point')
    op.drop_table('crash_location_point')
def downgrade():
    op.drop_table('quark_port_ip_address_associations')
    op.drop_table('quark_dns_nameservers')
    op.drop_index(op.f('ix_quark_ip_addresses_version'),
                  table_name='quark_ip_addresses')
    op.drop_index(op.f('ix_quark_ip_addresses_deallocated_at'),
                  table_name='quark_ip_addresses')
    op.drop_index(op.f('ix_quark_ip_addresses_address'),
                  table_name='quark_ip_addresses')
    op.drop_table('quark_ip_addresses')
    op.drop_table('quark_port_security_group_associations')
    op.drop_table('quark_routes')
    op.drop_index(op.f('ix_quark_subnets_tenant_id'),
                  table_name='quark_subnets')
    op.drop_index(op.f('ix_quark_subnets_segment_id'),
                  table_name='quark_subnets')
    op.drop_table('quark_subnets')
    op.drop_index(op.f('ix_quark_ports_name'), table_name='quark_ports')
    op.drop_index(op.f('ix_quark_ports_device_id'), table_name='quark_ports')
    op.drop_index('idx_ports_3', table_name='quark_ports')
    op.drop_index('idx_ports_2', table_name='quark_ports')
    op.drop_index('idx_ports_1', table_name='quark_ports')
    op.drop_table('quark_ports')
    op.drop_index(op.f('ix_quark_networks_tenant_id'),
                  table_name='quark_networks')
    op.drop_table('quark_networks')
    op.drop_table('quark_ip_policy_cidrs')
    op.drop_index(op.f('ix_quark_mac_addresses_deallocated_at'),
                  table_name='quark_mac_addresses')
    op.drop_table('quark_mac_addresses')
    op.drop_table('quark_security_group_rule')
    op.drop_table('quark_tags')
    op.drop_index(op.f('ix_quark_security_groups_tenant_id'),
                  table_name='quark_security_groups')
    op.drop_table('quark_security_groups')
    op.drop_table('quark_ip_policy')
    op.drop_table('quark_tag_associations')
    op.drop_table('quark_mac_address_ranges')
    op.drop_index(op.f('ix_quark_nvp_driver_lswitchport_port_id'),
                  table_name='quark_nvp_driver_lswitchport')
    op.drop_table('quark_nvp_driver_lswitchport')
    op.drop_index(op.f('ix_quark_nvp_driver_security_profile_nvp_id'),
                  table_name='quark_nvp_driver_security_profile')
    op.drop_table('quark_nvp_driver_security_profile')
    op.drop_index(op.f('ix_quark_nvp_driver_lswitch_nvp_id'),
                  table_name='quark_nvp_driver_lswitch')
    op.drop_index(op.f('ix_quark_nvp_driver_lswitch_network_id'),
                  table_name='quark_nvp_driver_lswitch')
    op.drop_table('quark_nvp_driver_lswitch')
    op.drop_index(op.f('ix_quotas_tenant_id'), table_name='quotas')
    op.drop_table('quotas')
    op.drop_table('quark_nvp_driver_qos')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_state_early_discharge_history_supervision_sentence_id'), table_name='state_early_discharge_history')
    op.drop_index(op.f('ix_state_early_discharge_history_state_code'), table_name='state_early_discharge_history')
    op.drop_index(op.f('ix_state_early_discharge_history_person_id'), table_name='state_early_discharge_history')
    op.drop_index(op.f('ix_state_early_discharge_history_incarceration_sentence_id'), table_name='state_early_discharge_history')
    op.drop_index(op.f('ix_state_early_discharge_history_external_id'), table_name='state_early_discharge_history')
    op.drop_index(op.f('ix_state_early_discharge_history_early_discharge_id'), table_name='state_early_discharge_history')
    op.drop_table('state_early_discharge_history')
    op.drop_index(op.f('ix_state_early_discharge_supervision_sentence_id'), table_name='state_early_discharge')
    op.drop_index(op.f('ix_state_early_discharge_state_code'), table_name='state_early_discharge')
    op.drop_index(op.f('ix_state_early_discharge_person_id'), table_name='state_early_discharge')
    op.drop_index(op.f('ix_state_early_discharge_incarceration_sentence_id'), table_name='state_early_discharge')
    op.drop_index(op.f('ix_state_early_discharge_external_id'), table_name='state_early_discharge')
    op.drop_table('state_early_discharge')

    op.execute('DROP TYPE state_acting_body_type;')
    op.execute('DROP TYPE state_early_discharge_decision;')
示例#48
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_star_user_id'), table_name='star_user')
    op.drop_table('star_user')
    op.drop_index(op.f('ix_jumbotron_img_id'), table_name='jumbotron_img')
    op.drop_table('jumbotron_img')
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'batchhistory',
        sa.Column('batchid', sa.INTEGER(), nullable=False),
        sa.Column('userid', sa.INTEGER(), nullable=False),
        sa.Column('event', sa.TEXT(), nullable=False),
        sa.Column('when',
                  postgresql.TIMESTAMP(timezone=True),
                  server_default=sa.text(u'now()'),
                  nullable=False),
        sa.ForeignKeyConstraint(['userid'], [u'users.userid'],
                                name=u'batchhistory_userid_fkey'),
        sa.CheckConstraint(
            "event=ANY(ARRAY['assigned','abandoned','submitted','revoked'])"),
    )
    op.create_index('batchhistorybyuserid',
                    'batchhistory', ['userid'],
                    unique=False)
    op.create_table(
        'pages',
        sa.Column('pageid', sa.INTEGER(), nullable=False),
        sa.Column('batchid', sa.INTEGER(), nullable=False),
        sa.Column('pageindex', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(['batchid'], [u'batches.batchid'],
                                name=u'pages_batchid_fkey'),
        sa.PrimaryKeyConstraint(u'pageid', name=op.f('pk_pages')),
        sa.CheckConstraint('pageindex>=0'),
    )
    op.create_index('pages_batchid_key',
                    'pages', ['batchid', 'pageindex'],
                    unique=True)
    op.create_index('pagesbybatchid', 'pages', ['batchid'], unique=False)
    op.create_table(
        'abnormalusage',
        sa.Column('metricid', sa.INTEGER(), nullable=False),
        sa.Column('tagid', sa.INTEGER(), nullable=True),
        sa.Column('labelid', sa.INTEGER(), nullable=True),
        sa.Column('degree', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(['labelid'], [u'labels.labelid'],
                                name=u'abnormalusage_labelid_fkey'),
        sa.ForeignKeyConstraint(['metricid'], [u'subtaskmetrics.metricid'],
                                name=u'abnormalusage_metricid_fkey'),
        sa.ForeignKeyConstraint(['tagid'], [u'tags.tagid'],
                                name=u'abnormalusage_tagid_fkey'),
        sa.CheckConstraint(
            'tagid IS NOT NULL AND labelid IS NULL OR tagid IS NULL AND labelid IS NOT NULL'
        ),
        sa.CheckConstraint('degree <> 0'),
    )
    op.create_index('abnormalusagebymetricid',
                    'abnormalusage', ['metricid'],
                    unique=False)
    op.create_table(
        'rawpieces', sa.Column('rawpieceid', sa.INTEGER(), nullable=False),
        sa.Column('taskid', sa.INTEGER(), nullable=False),
        sa.Column('rawtext', sa.TEXT(), nullable=False),
        sa.Column('assemblycontext',
                  sa.TEXT(),
                  server_default=sa.text(u"''::text"),
                  nullable=False),
        sa.Column('allocationcontext',
                  sa.TEXT(),
                  server_default=sa.text(u"''::text"),
                  nullable=False), sa.Column('meta', sa.TEXT(), nullable=True),
        sa.Column('isnew',
                  sa.BOOLEAN(),
                  server_default=sa.text(u'true'),
                  nullable=False),
        sa.Column('hypothesis', sa.TEXT(), nullable=True),
        sa.Column('words',
                  sa.INTEGER(),
                  server_default=sa.text(u'0'),
                  nullable=True),
        sa.Column('groupid', sa.INTEGER(), nullable=True),
        sa.Column('loadid', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(['groupid'],
                                [u'postprocessingutterancegroups.groupid'],
                                name=u'rawpieces_groupid_fkey'),
        sa.ForeignKeyConstraint(['taskid', 'loadid'],
                                [u'loads.taskid', u'loads.loadid'],
                                name=op.f('fk_rawpieces_taskid_loads')),
        sa.ForeignKeyConstraint(['taskid'], [u'tasks.taskid'],
                                name=u'rawpieces_taskid_fkey'),
        sa.PrimaryKeyConstraint(u'rawpieceid', name=op.f('pk_rawpieces')))
    op.create_index(op.f('ix_rawpieces_taskid'),
                    'rawpieces', ['taskid', 'assemblycontext'],
                    unique=True)
    op.create_index('rawpieces_groupid',
                    'rawpieces', ['groupid'],
                    unique=False)
    op.create_index('rawpieces_loadid', 'rawpieces', ['loadid'], unique=False)
    op.create_index('rawpieces_taskid', 'rawpieces', ['taskid'], unique=False)
    op.create_table(
        'subtaskmetricerrors',
        sa.Column('metricid', sa.INTEGER(), nullable=False),
        sa.Column('errortypeid', sa.INTEGER(), nullable=False),
        sa.Column('occurences', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(['errortypeid'], [u'errortypes.errortypeid'],
                                name=u'subtaskmetricerrors_errortypeid_fkey'),
        sa.ForeignKeyConstraint(['metricid'], [u'subtaskmetrics.metricid'],
                                name=u'subtaskmetricerrors_metricid_fkey'),
        sa.PrimaryKeyConstraint(u'metricid',
                                u'errortypeid',
                                name=op.f('pk_subtaskmetricerrors')))
    op.create_index('subtaskmetricerrorsbymetricid',
                    'subtaskmetricerrors', ['metricid'],
                    unique=False)
    op.create_table(
        'utteranceselectionfilterpieces',
        sa.Column('filterid', sa.INTEGER(), nullable=False),
        sa.Column('pieceindex',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False), sa.Column('data', sa.TEXT(),
                                             nullable=False),
        sa.ForeignKeyConstraint(
            ['filterid'], [u'utteranceselectionfilters.filterid'],
            name=u'utteranceselectionfilterpieces_filterid_fkey'),
        sa.PrimaryKeyConstraint(
            u'filterid',
            u'pieceindex',
            name=op.f('pk_utteranceselectionfilterpieces')))
    op.create_table(
        'customutterancegroupmembers',
        sa.Column('groupid', sa.INTEGER(), nullable=False),
        sa.Column('rawpieceid', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(
            ['groupid'], [u'customutterancegroups.groupid'],
            name=u'customutterancegroupmembers_groupid_fkey'),
        sa.ForeignKeyConstraint(
            ['rawpieceid'], [u'rawpieces.rawpieceid'],
            name=u'customutterancegroupmembers_rawpieceid_fkey'),
        sa.PrimaryKeyConstraint(u'groupid',
                                u'rawpieceid',
                                name=op.f('pk_customutterancegroupmembers')))
    op.create_index('customutterancegroupmember_by_rawpieceid',
                    'customutterancegroupmembers', ['rawpieceid'],
                    unique=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=True),
                    sa.Column('default', sa.Boolean(), nullable=True),
                    sa.Column('permissions', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_index(op.f('ix_roles_default'),
                    'roles', ['default'],
                    unique=False)
    op.create_table('teams_type', sa.Column('id', sa.Integer(),
                                            nullable=False),
                    sa.Column('type', sa.String(length=64), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('type'))
    op.create_table(
        'zones', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=True),
        sa.Column('abbreviation', sa.String(length=3), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('abbreviation'),
        sa.UniqueConstraint('name'))
    op.create_table(
        'countries', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=64), nullable=True),
        sa.Column('abbreviation', sa.String(length=3), nullable=True),
        sa.Column('zone_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['zone_id'],
            ['zones.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('abbreviation'),
        sa.UniqueConstraint('name'))
    op.create_table(
        'users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('email', sa.String(length=64), nullable=True),
        sa.Column('username', sa.String(length=64), nullable=True),
        sa.Column('password_hash', sa.String(length=128), nullable=True),
        sa.Column('role_id', sa.Integer(), nullable=True),
        sa.Column('confirmed', sa.Boolean(), nullable=True),
        sa.Column('name', sa.String(length=64), nullable=True),
        sa.Column('location', sa.String(length=64), nullable=True),
        sa.Column('about_me', sa.Text(), nullable=True),
        sa.Column('member_since', sa.DateTime(), nullable=True),
        sa.Column('last_seen', sa.DateTime(), nullable=True),
        sa.Column('avatar_hash', sa.String(length=32), nullable=True),
        sa.ForeignKeyConstraint(
            ['role_id'],
            ['roles.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'),
                    'users', ['username'],
                    unique=True)
    op.create_table(
        'game_teams', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('teams_type_id', sa.Integer(), nullable=True),
        sa.Column('zones_id', sa.Integer(), nullable=True),
        sa.Column('countries_id', sa.Integer(), nullable=True),
        sa.Column('real_name', sa.String(length=64), nullable=True),
        sa.Column('game_name', sa.String(length=64), nullable=True),
        sa.Column('abbreviation', sa.String(length=64), nullable=True),
        sa.ForeignKeyConstraint(
            ['countries_id'],
            ['countries.id'],
        ), sa.ForeignKeyConstraint(
            ['teams_type_id'],
            ['teams_type.id'],
        ), sa.ForeignKeyConstraint(
            ['zones_id'],
            ['zones.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('abbreviation'),
        sa.UniqueConstraint('game_name'), sa.UniqueConstraint('real_name'))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_itemaudio_language_code"), table_name="itemaudio")
    op.drop_index(op.f("ix_itemaudio_audio_id"), table_name="itemaudio")
    op.drop_table("itemaudio")
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('state_early_discharge',
    sa.Column('external_id', sa.String(length=255), nullable=True),
    sa.Column('state_code', sa.String(length=255), nullable=False),
    sa.Column('county_code', sa.String(length=255), nullable=True),
    sa.Column('decision_date', sa.Date(), nullable=True),
    sa.Column('decision', sa.Enum('REQUEST_DENIED', 'SENTENCE_TERMINATION_GRANTED', 'UNSUPERVISED_PROBATION_GRANTED', name='state_early_discharge_decision'), nullable=True),
    sa.Column('decision_raw_text', sa.String(length=255), nullable=True),
    sa.Column('deciding_body_type', sa.Enum('COURT', 'PAROLE_BOARD', 'SENTENCED_PERSON', 'SUPERVISION_OFFICER', name='state_acting_body_type'), nullable=True),
    sa.Column('deciding_body_type_raw_text', sa.String(length=255), nullable=True),
    sa.Column('request_date', sa.Date(), nullable=True),
    sa.Column('requesting_body_type', sa.Enum('COURT', 'PAROLE_BOARD', 'SENTENCED_PERSON', 'SUPERVISION_OFFICER', name='state_acting_body_type'), nullable=True),
    sa.Column('requesting_body_type_raw_text', sa.String(length=255), nullable=True),
    sa.Column('early_discharge_id', sa.Integer(), nullable=False),
    sa.Column('supervision_sentence_id', sa.Integer(), nullable=True),
    sa.Column('incarceration_sentence_id', sa.Integer(), nullable=True),
    sa.Column('person_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['incarceration_sentence_id'], ['state_incarceration_sentence.incarceration_sentence_id'], initially='DEFERRED', deferrable=True),
    sa.ForeignKeyConstraint(['person_id'], ['state_person.person_id'], initially='DEFERRED', deferrable=True),
    sa.ForeignKeyConstraint(['supervision_sentence_id'], ['state_supervision_sentence.supervision_sentence_id'], initially='DEFERRED', deferrable=True),
    sa.PrimaryKeyConstraint('early_discharge_id')
    )
    op.create_index(op.f('ix_state_early_discharge_external_id'), 'state_early_discharge', ['external_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_incarceration_sentence_id'), 'state_early_discharge', ['incarceration_sentence_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_person_id'), 'state_early_discharge', ['person_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_state_code'), 'state_early_discharge', ['state_code'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_supervision_sentence_id'), 'state_early_discharge', ['supervision_sentence_id'], unique=False)
    op.create_table('state_early_discharge_history',
    sa.Column('valid_from', sa.DateTime(), nullable=False),
    sa.Column('valid_to', sa.DateTime(), nullable=True),
    sa.Column('external_id', sa.String(length=255), nullable=True),
    sa.Column('state_code', sa.String(length=255), nullable=False),
    sa.Column('county_code', sa.String(length=255), nullable=True),
    sa.Column('decision_date', sa.Date(), nullable=True),
    sa.Column('decision', sa.Enum('REQUEST_DENIED', 'SENTENCE_TERMINATION_GRANTED', 'UNSUPERVISED_PROBATION_GRANTED', name='state_early_discharge_decision'), nullable=True),
    sa.Column('decision_raw_text', sa.String(length=255), nullable=True),
    sa.Column('deciding_body_type', sa.Enum('COURT', 'PAROLE_BOARD', 'SENTENCED_PERSON', 'SUPERVISION_OFFICER', name='state_acting_body_type'), nullable=True),
    sa.Column('deciding_body_type_raw_text', sa.String(length=255), nullable=True),
    sa.Column('request_date', sa.Date(), nullable=True),
    sa.Column('requesting_body_type', sa.Enum('COURT', 'PAROLE_BOARD', 'SENTENCED_PERSON', 'SUPERVISION_OFFICER', name='state_acting_body_type'), nullable=True),
    sa.Column('requesting_body_type_raw_text', sa.String(length=255), nullable=True),
    sa.Column('early_discharge_history_id', sa.Integer(), nullable=False),
    sa.Column('early_discharge_id', sa.Integer(), nullable=False),
    sa.Column('supervision_sentence_id', sa.Integer(), nullable=True),
    sa.Column('incarceration_sentence_id', sa.Integer(), nullable=True),
    sa.Column('person_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['early_discharge_id'], ['state_early_discharge.early_discharge_id'], ),
    sa.ForeignKeyConstraint(['incarceration_sentence_id'], ['state_incarceration_sentence.incarceration_sentence_id'], initially='DEFERRED', deferrable=True),
    sa.ForeignKeyConstraint(['person_id'], ['state_person.person_id'], initially='DEFERRED', deferrable=True),
    sa.ForeignKeyConstraint(['supervision_sentence_id'], ['state_supervision_sentence.supervision_sentence_id'], initially='DEFERRED', deferrable=True),
    sa.PrimaryKeyConstraint('early_discharge_history_id')
    )
    op.create_index(op.f('ix_state_early_discharge_history_early_discharge_id'), 'state_early_discharge_history', ['early_discharge_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_history_external_id'), 'state_early_discharge_history', ['external_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_history_incarceration_sentence_id'), 'state_early_discharge_history', ['incarceration_sentence_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_history_person_id'), 'state_early_discharge_history', ['person_id'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_history_state_code'), 'state_early_discharge_history', ['state_code'], unique=False)
    op.create_index(op.f('ix_state_early_discharge_history_supervision_sentence_id'), 'state_early_discharge_history', ['supervision_sentence_id'], unique=False)
示例#53
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_contacts_email'), table_name='contacts')
    op.drop_table('contacts')
示例#54
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('_idnum_index',
                    sa.Column('idnum_pk', sa.Integer(), nullable=False),
                    sa.Column('indexed_at_utc', sa.DateTime(), nullable=False),
                    sa.Column('patient_pk', sa.Integer(), nullable=True),
                    sa.Column('which_idnum', sa.Integer(), nullable=False),
                    sa.Column('idnum_value', sa.BigInteger(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['which_idnum'], ['_idnum_definitions.which_idnum'],
                        name=op.f('fk__idnum_index_which_idnum')),
                    sa.PrimaryKeyConstraint('idnum_pk',
                                            name=op.f('pk__idnum_index')),
                    mysql_charset='utf8mb4 COLLATE utf8mb4_unicode_ci',
                    mysql_engine='InnoDB',
                    mysql_row_format='DYNAMIC')
    with op.batch_alter_table('_idnum_index', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix__idnum_index_idnum_pk'),
                              ['idnum_pk'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__idnum_index_patient_pk'),
                              ['patient_pk'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__idnum_index_which_idnum'),
                              ['which_idnum'],
                              unique=False)

    op.create_table(
        '_task_index',
        sa.Column('index_entry_pk',
                  sa.Integer(),
                  autoincrement=True,
                  nullable=False),
        sa.Column('indexed_at_utc', sa.DateTime(), nullable=False),
        sa.Column('task_table_name', sa.String(length=128), nullable=True),
        sa.Column('task_pk', sa.Integer(), nullable=True),
        sa.Column('patient_pk', sa.Integer(), nullable=True),
        sa.Column('device_id', sa.Integer(), nullable=False),
        sa.Column('era', sa.String(length=32), nullable=False),
        sa.Column('when_created_utc', sa.DateTime(), nullable=False),
        sa.Column('when_created_iso',
                  camcops_server.cc_modules.cc_sqla_coltypes.
                  PendulumDateTimeAsIsoTextColType(length=32),
                  nullable=False),
        sa.Column('when_added_batch_utc', sa.DateTime(), nullable=False),
        sa.Column('adding_user_id', sa.Integer(), nullable=True),
        sa.Column('group_id', sa.Integer(), nullable=False),
        sa.Column('task_is_complete', sa.Boolean(), nullable=False),
        sa.ForeignKeyConstraint(['adding_user_id'], ['_security_users.id'],
                                name=op.f('fk__task_index_adding_user_id')),
        sa.ForeignKeyConstraint(['device_id'], ['_security_devices.id'],
                                name=op.f('fk__task_index_device_id')),
        sa.ForeignKeyConstraint(['group_id'], ['_security_groups.id'],
                                name=op.f('fk__task_index_group_id')),
        sa.ForeignKeyConstraint(['patient_pk'], ['patient._pk'],
                                name=op.f('fk__task_index_patient_pk')),
        sa.PrimaryKeyConstraint('index_entry_pk', name=op.f('pk__task_index')),
        mysql_charset='utf8mb4 COLLATE utf8mb4_unicode_ci',
        mysql_engine='InnoDB',
        mysql_row_format='DYNAMIC')
    with op.batch_alter_table('_task_index', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix__task_index_device_id'),
                              ['device_id'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_era'), ['era'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_group_id'),
                              ['group_id'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_patient_pk'),
                              ['patient_pk'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_task_pk'),
                              ['task_pk'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_task_table_name'),
                              ['task_table_name'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_when_created_iso'),
                              ['when_created_iso'],
                              unique=False)
        batch_op.create_index(batch_op.f('ix__task_index_when_created_utc'),
                              ['when_created_utc'],
                              unique=False)

    # ### end Alembic commands ###

    if not context.is_offline_mode():
        # Offline mode means "print SQL only". So we only execute the following
        # in online ("talk to the database") mode:
        cfg = get_default_config_from_os_env()
        with cfg.get_dbsession_context() as dbsession:
            reindex_everything(dbsession)
示例#55
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_book_published'), table_name='book')
    op.drop_table('book')
示例#56
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_mottoes_user_id'), table_name='mottoes')
    op.drop_index(op.f('ix_mottoes_deleted_at'), table_name='mottoes')
    op.drop_table('mottoes')
示例#57
0
def pk_on_alembic_version_table():
    inspector = sa.inspect(op.get_bind())
    pk = inspector.get_pk_constraint('alembic_version')
    if not pk['constrained_columns']:
        op.create_primary_key(op.f('pk_alembic_version'), 'alembic_version',
                              ['version_num'])
def downgrade():
    op.drop_index(op.f('ix_brief_responses_created_at'), table_name='brief_responses')
    op.drop_table('brief_responses')
示例#59
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_column('users', 'password_hash')
    op.drop_column('users', 'email')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_location_minzdrav_name"), table_name="location")
    op.drop_column("location", "minzdrav_name")