Esempio n. 1
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'question_voter1', sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('question_id', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(['question_id'], ['question.id'],
                                name='fk_question_voter1_question_id_question',
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name='fk_question_voter1_user_id_user',
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('user_id',
                                'question_id',
                                name='pk_question_voter1'))
    op.create_table(
        'answer1', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('question_id', sa.INTEGER(), nullable=True),
        sa.Column('content', sa.TEXT(), nullable=False),
        sa.Column('create_date', sa.DATETIME(), nullable=False),
        sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('modify_date', sa.DATETIME(), nullable=True),
        sa.ForeignKeyConstraint(['question_id'], ['question.id'],
                                name='fk_answer1_question_id_question',
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name='fk_answer1_user_id_user',
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id', name='pk_answer1'))
    op.create_table(
        'comment1', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('content', sa.TEXT(), nullable=False),
        sa.Column('create_date', sa.DATETIME(), nullable=False),
        sa.Column('modify_date', sa.DATETIME(), nullable=True),
        sa.Column('question_id', sa.INTEGER(), nullable=True),
        sa.Column('answer_id', sa.INTEGER(), nullable=True),
        sa.ForeignKeyConstraint(['answer_id'], ['answer.id'],
                                name='fk_comment1_answer_id_answer',
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['question_id'], ['question.id'],
                                name='fk_comment1_question_id_question',
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name='fk_comment1_user_id_user',
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id', name='pk_comment1'))
    op.create_table(
        'question1', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('subject', sa.VARCHAR(length=200), nullable=False),
        sa.Column('content', sa.TEXT(), nullable=False),
        sa.Column('create_date', sa.DATETIME(), nullable=False),
        sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('modify_date', sa.DATETIME(), nullable=True),
        sa.Column('look',
                  sa.INTEGER(),
                  server_default=sa.text("'1'"),
                  nullable=False),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name='fk_question1_user_id_user',
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id', name='pk_question1'))
    op.create_table(
        'answer_voter1', sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('answer_id', sa.INTEGER(), nullable=False),
        sa.ForeignKeyConstraint(['answer_id'], ['answer.id'],
                                name='fk_answer_voter1_answer_id_answer',
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['user.id'],
                                name='fk_answer_voter1_user_id_user',
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('user_id',
                                'answer_id',
                                name='pk_answer_voter1'))
Esempio n. 2
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'website_banned',
        sa.Column('ai_industries',
                  sa.ARRAY(sa.String()),
                  server_default='{}',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('category',
                  sa.String(length=50),
                  server_default='',
                  nullable=True))
    op.add_column('website_banned',
                  sa.Column('city_code', sa.String(length=50), nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('code_language',
                  sa.String(length=50),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('content', sa.TEXT(), server_default='', nullable=True))
    op.add_column('website_banned',
                  sa.Column('domain', sa.String(length=100), nullable=True))
    op.add_column('website_banned',
                  sa.Column('domain_id', sa.BigInteger(), nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('effective_url', sa.String(length=254), nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('group',
                  sa.String(length=100),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('host_dept',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('host_type',
                  sa.String(length=50),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('http_status',
                  sa.Integer(),
                  server_default='-1',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('http_status_list',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('industries',
                  sa.ARRAY(sa.String()),
                  server_default='{}',
                  nullable=True))
    op.add_column('website_banned',
                  sa.Column('ip', sa.String(length=50), nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('ip_area',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('is_auto', sa.Boolean(), server_default='0', nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('region_code', sa.String(length=100), nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('tags',
                  sa.ARRAY(sa.String()),
                  server_default='{}',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('title',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_banned',
        sa.Column('web_type',
                  sa.String(length=30),
                  server_default='',
                  nullable=True))
    op.create_index(op.f('ix_website_banned_ai_industries'),
                    'website_banned', ['ai_industries'],
                    unique=False)
    op.create_index(op.f('ix_website_banned_category'),
                    'website_banned', ['category'],
                    unique=False)
    op.create_index(op.f('ix_website_banned_domain'),
                    'website_banned', ['domain'],
                    unique=False)
    op.create_index(op.f('ix_website_banned_http_status'),
                    'website_banned', ['http_status'],
                    unique=False)
    op.create_index(op.f('ix_website_banned_industries'),
                    'website_banned', ['industries'],
                    unique=False)
    op.create_index(op.f('ix_website_banned_ip'),
                    'website_banned', ['ip'],
                    unique=False)
    op.create_index(op.f('ix_website_banned_web_type'),
                    'website_banned', ['web_type'],
                    unique=False)
    op.add_column(
        'website_duplicated',
        sa.Column('ai_industries',
                  sa.ARRAY(sa.String()),
                  server_default='{}',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('category',
                  sa.String(length=50),
                  server_default='',
                  nullable=True))
    op.add_column('website_duplicated',
                  sa.Column('city_code', sa.String(length=50), nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('code_language',
                  sa.String(length=50),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('content', sa.TEXT(), server_default='', nullable=True))
    op.add_column('website_duplicated',
                  sa.Column('domain', sa.String(length=100), nullable=True))
    op.add_column('website_duplicated',
                  sa.Column('domain_id', sa.BigInteger(), nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('effective_url', sa.String(length=254), nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('host_dept',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('host_type',
                  sa.String(length=50),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('http_status',
                  sa.Integer(),
                  server_default='-1',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('http_status_list',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('industries',
                  sa.ARRAY(sa.String()),
                  server_default='{}',
                  nullable=True))
    op.add_column('website_duplicated',
                  sa.Column('ip', sa.String(length=50), nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('ip_area',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('is_auto', sa.Boolean(), server_default='0', nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('region_code', sa.String(length=100), nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('tags',
                  sa.ARRAY(sa.String()),
                  server_default='{}',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('title',
                  sa.String(length=254),
                  server_default='',
                  nullable=True))
    op.add_column(
        'website_duplicated',
        sa.Column('web_type',
                  sa.String(length=30),
                  server_default='',
                  nullable=True))
    op.create_index(op.f('ix_website_duplicated_ai_industries'),
                    'website_duplicated', ['ai_industries'],
                    unique=False)
    op.create_index(op.f('ix_website_duplicated_category'),
                    'website_duplicated', ['category'],
                    unique=False)
    op.create_index(op.f('ix_website_duplicated_domain'),
                    'website_duplicated', ['domain'],
                    unique=False)
    op.create_index(op.f('ix_website_duplicated_http_status'),
                    'website_duplicated', ['http_status'],
                    unique=False)
    op.create_index(op.f('ix_website_duplicated_industries'),
                    'website_duplicated', ['industries'],
                    unique=False)
    op.create_index(op.f('ix_website_duplicated_ip'),
                    'website_duplicated', ['ip'],
                    unique=False)
    op.create_index(op.f('ix_website_duplicated_web_type'),
                    'website_duplicated', ['web_type'],
                    unique=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('v1_1_CaseSolutions',
                    'CaseId',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Origin',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'KnowledgeProviderPathCount',
                    existing_type=sa.SMALLINT(),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'KnowledgeProviderPath1Name',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Node1Path1Category',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Node1Path1Type',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Node1Path1Reference',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Node2Path1Category',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Node2Path1Type',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Node2Path1Reference',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Edge1Path1Predicate',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Edge1Path1Ends',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_CaseSolutions',
                    'Edge1Path1Reference',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_GlobalSimilarity',
                    'Subject',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_GlobalSimilarity',
                    'Object',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_GlobalSimilarity',
                    'Predicate',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_GlobalSimilarity',
                    'CaseId',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_GlobalSimilarity',
                    'CaseValue',
                    existing_type=postgresql.DOUBLE_PRECISION(precision=53),
                    nullable=False)
    op.alter_column('v1_1_KnowledgeProviders',
                    'Name',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=False)
    op.alter_column('v1_1_KnowledgeProviders',
                    'Url',
                    existing_type=sa.TEXT(),
                    nullable=False)
Esempio n. 4
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'imp_catalog_page',
        sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('entry_point_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False,
                  comment='FK to entry_point_id table'),
        sa.Column('url',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False,
                  comment='url to product'),
        sa.Column('title',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False,
                  comment='Product title form catalog page'),
        sa.Column('img',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True,
                  comment='url to main image'),
        sa.Column('brand',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True,
                  comment='Brand Name'),
        sa.Column('active',
                  sa.BOOLEAN(),
                  autoincrement=False,
                  nullable=False,
                  comment='Is record is active'),
        sa.Column('deleted',
                  sa.BOOLEAN(),
                  autoincrement=False,
                  nullable=False,
                  comment='Is record is deleted'),
        sa.Column('created_by',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False,
                  comment='Who created record'),
        sa.Column('creation_date',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=False,
                  comment='Timestamp created record'),
        sa.Column('last_update_by',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True,
                  comment='Who last update record'),
        sa.Column('last_update_date',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True,
                  comment='Timestamp last update record'),
        sa.ForeignKeyConstraint(['entry_point_id'], ['price_entry_point.id'],
                                name='imp_catalog_page_entry_point_id_fkey'),
        sa.PrimaryKeyConstraint('id', name='imp_catalog_page_pkey'))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('project', schema=None) as batch_op:
        batch_op.drop_column('vsu')
        batch_op.drop_column('msu')

    with op.batch_alter_table('init_data', schema=None) as batch_op:
        batch_op.add_column(sa.Column('value_share', sa.FLOAT(),
                                      nullable=True))
        batch_op.add_column(sa.Column('old_size', sa.FLOAT(), nullable=True))
        batch_op.add_column(sa.Column('old_wd', sa.FLOAT(), nullable=True))
        batch_op.add_column(sa.Column('revenue', sa.FLOAT(), nullable=True))
        batch_op.drop_column('new_value_share')
        batch_op.drop_column('new_value_sales')
        batch_op.drop_column('index_volume_share')
        batch_op.drop_column('diff_value_sales')
        batch_op.drop_column('base_value_share')
        batch_op.drop_column('base_value_sales')

    op.create_table('zero_price_level',
                    sa.Column('sku_name', sa.TEXT(), nullable=True),
                    sa.Column('zero_percent', sa.FLOAT(), nullable=True),
                    sa.Column('project_id', sa.BIGINT(), nullable=True))
    op.create_table(
        'hbu_saudi', sa.Column('RespondentID', sa.BIGINT(), nullable=True),
        sa.Column('RespondentWeight', sa.BIGINT(), nullable=True),
        sa.Column('ALMARAI  TR.P  480GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI  TR.P  120GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI  TR.P  240GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI  TR.P  360GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI SQ 108GX3 (2+1 FR)', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI  SQ.P 432GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI SQ 216GX3 (SP.PR)', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAISQ 108G BOX', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI  SQ.P  216GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI BLU 500GX2 GLASS L/C(SP', sa.FLOAT(),
                  nullable=True),
        sa.Column('ALMARAI BLU 900GX2 GLASS(SP.PR)', sa.FLOAT(),
                  nullable=True),
        sa.Column('ALMARAI GOLD 500GX2 GLASS (SP.PR)',
                  sa.FLOAT(),
                  nullable=True),
        sa.Column('ALMARAI GOLD 900GX2 GLASS (SP.PR)',
                  sa.FLOAT(),
                  nullable=True),
        sa.Column('ALMARAI GLASS BLU  500GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI GLASS BLU  900GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI GLASS GOLD  500GR', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI SQ 432G (SP.PRICE)', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI SQ 432GX2 (SP.PRICE)', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI TR 120GX5 (1 Fr', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI TR 480GX2 (SP)', sa.FLOAT(), nullable=True),
        sa.Column('ALMARAI BLU 500GX2 GLASS(SP.PR)', sa.FLOAT(),
                  nullable=True),
        sa.Column('LVQR  TR.P 120GR', sa.FLOAT(), nullable=True),
        sa.Column('LVQR  TR.P 480GR', sa.FLOAT(), nullable=True),
        sa.Column('LVQR  TR.P 360GR', sa.FLOAT(), nullable=True),
        sa.Column('LVQR  TR.P 240GR', sa.FLOAT(), nullable=True),
        sa.Column('LVQR TR 120GX5 (4+1 FR)', sa.FLOAT(), nullable=True),
        sa.Column('LVQR TR 480GX2(SP.PRICE)', sa.FLOAT(), nullable=True),
        sa.Column('LVQR  TUB 200GR', sa.FLOAT(), nullable=True),
        sa.Column('LVQR  TUB 500GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW  TUB480GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW  TR.P 480GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW  TR.P 120GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW  TR.P 240GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW TR 120GX4 (S.P)', sa.FLOAT(), nullable=True),
        sa.Column('JAW TR 120GX5 (8PO)(SP)', sa.FLOAT(), nullable=True),
        sa.Column('PUCK  SQ.P 108GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK  SQ.P 216GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK  SQ.P 432GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK 500GX2 GLASS BLUE(SP.PRICE)',
                  sa.FLOAT(),
                  nullable=True),
        sa.Column('PUCK 910GX2 JAR BLUE (SP.PRICE)', sa.FLOAT(),
                  nullable=True),
        sa.Column('PUCK GLASS BLU  240GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK GLASS BLU  500GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK GLASS BLU  910GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK GLASS BLU  1100GR', sa.FLOAT(), nullable=True),
        sa.Column('PUCK TR 120GX5 (4+1 FREE)', sa.FLOAT(), nullable=True),
        sa.Column('PUCK 650GR JAR(30% EXTR A) (BLUE)',
                  sa.FLOAT(),
                  nullable=True),
        sa.Column('SALIM  TR.P 120GR', sa.FLOAT(), nullable=True),
        sa.Column('PRESIDENT TR 120GX5 (4+1FR)', sa.FLOAT(), nullable=True),
        sa.Column('NADEC  TR.P 120GR', sa.FLOAT(), nullable=True),
        sa.Column('NADEC 500GX2 GLASS BLUE (SP.PRICE)',
                  sa.FLOAT(),
                  nullable=True),
        sa.Column('NADEC 500GX2 GLASS GOLD (SP PRICE)',
                  sa.FLOAT(),
                  nullable=True),
        sa.Column('NADEC GLASS BLU  500GR', sa.FLOAT(), nullable=True),
        sa.Column('NADEC TR 120GX5 (4+1 FREE)', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SQ 216GX3 (SP. PRICE)', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SQ 432GX2 (SP.P)', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SQ 108GX5 (SP.P)', sa.FLOAT(), nullable=True),
        sa.Column('KIRI  SQ.P 324GR', sa.FLOAT(), nullable=True),
        sa.Column('KIRI  SQ.P 432GR', sa.FLOAT(), nullable=True),
        sa.Column('KIRI  SQ.P 108GR', sa.FLOAT(), nullable=True),
        sa.Column('KIRI  SQ.P 216GR', sa.FLOAT(), nullable=True),
        sa.Column('KIRI  TUB 350GR', sa.FLOAT(), nullable=True),
        sa.Column('KIRI  TUB 500GR', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SQ 108GX5 (1 FREE)', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SQ 432GX3(24P)(SP.P)', sa.FLOAT(), nullable=True),
        sa.Column('KRAFT GLASS480GX2 GOLD JAR(SP)', sa.FLOAT(), nullable=True),
        sa.Column('KRAFT 870GX2GOLD JAR(SP)', sa.FLOAT(), nullable=True),
        sa.Column('PHILADELPHIA  TUB 200GR', sa.FLOAT(), nullable=True),
        sa.Column('PHILADELPHIA  TUB 300GR', sa.FLOAT(), nullable=True),
        sa.Column('PHILADELPHIA  TUB  300GR', sa.FLOAT(), nullable=True),
        sa.Column('PHILADELPHIA  TUB 500GR', sa.FLOAT(), nullable=True),
        sa.Column('PHILADELPHIA  TUB 1650GR', sa.FLOAT(), nullable=True),
        sa.Column('PHILADELPHIA  TUB  200GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW 8 PIECES 120 GR', sa.FLOAT(), nullable=True),
        sa.Column('JAW 480X2 32X2', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SP Greek Style 6p', sa.FLOAT(), nullable=True),
        sa.Column('KIRI SP Greek style 24p', sa.FLOAT(), nullable=True),
        sa.Column('KIRI Jars 240g', sa.FLOAT(), nullable=True),
        sa.Column('KIRI Jars 440g', sa.FLOAT(), nullable=True),
        sa.Column('KIRI Jars 600g', sa.FLOAT(), nullable=True),
        sa.Column('KIRI Tubs Greek style 200g', sa.FLOAT(), nullable=True),
        sa.Column('KIRI Tubs Greek style 500g', sa.FLOAT(), nullable=True),
        sa.Column('JAW Jar 240g', sa.FLOAT(), nullable=True),
        sa.Column('JAW Jar 500g', sa.FLOAT(), nullable=True),
        sa.Column('JAW Jar 900g', sa.FLOAT(), nullable=True),
        sa.Column('LVQR TR.P Organic 8p', sa.FLOAT(), nullable=True),
        sa.Column('-0.4', sa.FLOAT(), nullable=True),
        sa.Column('-0.35', sa.FLOAT(), nullable=True),
        sa.Column('-0.3', sa.FLOAT(), nullable=True),
        sa.Column('-0.25', sa.FLOAT(), nullable=True),
        sa.Column('-0.2', sa.FLOAT(), nullable=True),
        sa.Column('-0.15', sa.FLOAT(), nullable=True),
        sa.Column('-0.1', sa.FLOAT(), nullable=True),
        sa.Column('-0.05', sa.FLOAT(), nullable=True),
        sa.Column('0', sa.FLOAT(), nullable=True),
        sa.Column('0.05', sa.FLOAT(), nullable=True),
        sa.Column('0.1', sa.FLOAT(), nullable=True),
        sa.Column('0.15', sa.FLOAT(), nullable=True),
        sa.Column('0.2', sa.FLOAT(), nullable=True),
        sa.Column('0.25', sa.FLOAT(), nullable=True),
        sa.Column('0.3', sa.FLOAT(), nullable=True),
        sa.Column('0.35', sa.FLOAT(), nullable=True),
        sa.Column('0.4', sa.FLOAT(), nullable=True))
Esempio n. 6
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('guest_requests', schema=None) as batch_op:
        batch_op.alter_column('user_data',
                              existing_type=sa.TEXT(),
                              nullable=True)
Esempio n. 7
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.TEXT(), nullable=True),
                    sa.Column('email', sa.TEXT(), nullable=False),
                    sa.Column('password', sa.TEXT(), nullable=False),
                    sa.Column('salt', sa.TEXT(), nullable=False),
                    sa.Column('role', sa.Integer(), nullable=False),
                    sa.Column('state', sa.Integer(), nullable=False),
                    sa.Column('token', sa.TEXT(), nullable=True),
                    sa.Column('token_period', sa.DateTime(), nullable=True),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['role'],
                        ['role.id'],
                    ), sa.ForeignKeyConstraint(
                        ['state'],
                        ['state.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'user_profile', sa.Column('account_id', sa.Integer(), nullable=False),
        sa.Column('member_id', sa.Integer(), nullable=False),
        sa.Column('first_name', sa.TEXT(), nullable=False),
        sa.Column('last_name', sa.TEXT(), nullable=False),
        sa.Column('first_name_kana', sa.TEXT(), nullable=False),
        sa.Column('last_name_kana', sa.TEXT(), nullable=False),
        sa.Column('organization', sa.TEXT(), nullable=False),
        sa.Column('department', sa.TEXT(), nullable=True),
        sa.Column('address_type', sa.Integer(), nullable=False),
        sa.Column('zip', sa.Integer(), nullable=False),
        sa.Column('prefecture', sa.TEXT(), nullable=False),
        sa.Column('municipalities', sa.TEXT(), nullable=False),
        sa.Column('address1', sa.TEXT(), nullable=False),
        sa.Column('address2', sa.TEXT(), nullable=True),
        sa.Column('phone', sa.TEXT(), nullable=False),
        sa.ForeignKeyConstraint(
            ['account_id'],
            ['user.id'],
        ), sa.ForeignKeyConstraint(
            ['address_type'],
            ['address_type.id'],
        ), sa.ForeignKeyConstraint(
            ['member_id'],
            ['member.id'],
        ), sa.PrimaryKeyConstraint('account_id'))
Esempio n. 8
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'job_runs',
        sa.Column('result', sa.TEXT(), autoincrement=False, nullable=False))
    op.drop_column('job_runs', 'status')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('recommendations',
                  sa.Column('interpretation', sa.TEXT(), nullable=True))
def upgrade():
    op.add_column('user', sa.Column('shape', sa.TEXT(), nullable=True))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('rules', 'content', existing_type=sa.TEXT(), nullable=True)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('todos',
                    'description',
                    existing_type=sa.TEXT(),
                    nullable=True)
Esempio n. 13
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'posts', type_='foreignkey')
    op.drop_column('posts', 'user_id')
    op.create_table(
        'client',
        sa.Column(
            'id',
            sa.INTEGER(),
            server_default=sa.text(u"nextval('client_id_seq'::regclass)"),
            nullable=False),
        sa.Column('name',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('description',
                  sa.VARCHAR(length=400),
                  autoincrement=False,
                  nullable=True),
        sa.Column('user_id',
                  sa.VARCHAR(length=200),
                  autoincrement=False,
                  nullable=True),
        sa.Column('client_id',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('client_secret',
                  sa.VARCHAR(length=55),
                  autoincrement=False,
                  nullable=False),
        sa.Column('is_confidential',
                  sa.BOOLEAN(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('redirect_uris_text',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('default_scopes_text',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=u'client_pkey'),
        postgresql_ignore_search_path=False)
    op.create_table(
        'user',
        sa.Column('id',
                  sa.INTEGER(),
                  server_default=sa.text(u"nextval('user_id_seq'::regclass)"),
                  nullable=False),
        sa.Column('username',
                  sa.VARCHAR(length=100),
                  autoincrement=False,
                  nullable=False),
        sa.Column('name',
                  sa.VARCHAR(length=200),
                  autoincrement=False,
                  nullable=True),
        sa.Column('password',
                  sa.VARCHAR(length=100),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name=u'user_pkey'),
        postgresql_ignore_search_path=False)
    op.create_table(
        'token', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('client_id',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=False),
        sa.Column('user_id', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('token_type',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('access_token',
                  sa.VARCHAR(length=255),
                  autoincrement=False,
                  nullable=True),
        sa.Column('refresh_token',
                  sa.VARCHAR(length=255),
                  autoincrement=False,
                  nullable=True),
        sa.Column('expires',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('_scopes', sa.TEXT(), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['client_id'], [u'client.client_id'],
                                name=u'token_client_id_fkey'),
        sa.ForeignKeyConstraint(['user_id'], [u'user.id'],
                                name=u'token_user_id_fkey'),
        sa.PrimaryKeyConstraint('id', name=u'token_pkey'))
    op.create_table(
        'grant', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('user_id', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('client_id',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=False),
        sa.Column('code',
                  sa.VARCHAR(length=255),
                  autoincrement=False,
                  nullable=False),
        sa.Column('redirect_uri',
                  sa.VARCHAR(length=255),
                  autoincrement=False,
                  nullable=True),
        sa.Column('expires',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('_scopes', sa.TEXT(), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['client_id'], [u'client.client_id'],
                                name=u'grant_client_id_fkey'),
        sa.ForeignKeyConstraint(['user_id'], [u'user.id'],
                                name=u'grant_user_id_fkey'),
        sa.PrimaryKeyConstraint('id', name=u'grant_pkey'))
    op.drop_index(op.f('ix_grants_code'), table_name='grants')
    op.drop_table('grants')
    op.drop_table('tokens')
    op.drop_index(op.f('ix_clients_client_secret'), table_name='clients')
    op.drop_table('clients')
    op.drop_table('users')
Esempio n. 14
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("UserData",
                  sa.Column("googleAssoc", sa.BOOLEAN(), nullable=True))
    op.add_column("UserData", sa.Column("googleID", sa.TEXT(), nullable=True))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('data_batches_v2',
                    sa.Column('id',
                              sa.Integer(),
                              autoincrement=True,
                              nullable=False,
                              comment='id'),
                    sa.Column('event_time',
                              sa.TIMESTAMP(timezone=True),
                              nullable=False,
                              comment='event_time'),
                    sa.Column('dataset_id',
                              sa.Integer(),
                              nullable=False,
                              comment='dataset_id'),
                    sa.Column('path',
                              sa.String(length=512),
                              nullable=True,
                              comment='path'),
                    sa.Column('state',
                              sa.Enum('NEW',
                                      'SUCCESS',
                                      'FAILED',
                                      'IMPORTING',
                                      name='batchstate',
                                      native_enum=False),
                              nullable=True,
                              comment='state'),
                    sa.Column('move',
                              sa.Boolean(),
                              nullable=True,
                              comment='move'),
                    sa.Column('details',
                              sa.LargeBinary(),
                              nullable=True,
                              comment='details'),
                    sa.Column('file_size',
                              sa.Integer(),
                              nullable=True,
                              comment='file_size'),
                    sa.Column('num_imported_file',
                              sa.Integer(),
                              nullable=True,
                              comment='num_imported_file'),
                    sa.Column('num_file',
                              sa.Integer(),
                              nullable=True,
                              comment='num_file'),
                    sa.Column('cmt',
                              sa.Text(),
                              nullable=True,
                              comment='comment'),
                    sa.Column('created_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='created_at'),
                    sa.Column('updated_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='updated_at'),
                    sa.Column('deleted_at',
                              sa.DateTime(timezone=True),
                              nullable=True,
                              comment='deleted_at'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('event_time',
                                        'dataset_id',
                                        name='uniq_event_time_dataset_id'),
                    comment='This is webconsole dataset table',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_table('datasets_v2',
                    sa.Column('id',
                              sa.Integer(),
                              autoincrement=True,
                              nullable=False,
                              comment='id'),
                    sa.Column('name',
                              sa.String(length=255),
                              nullable=False,
                              comment='dataset name'),
                    sa.Column('dataset_type',
                              sa.Enum('PSI',
                                      'STREAMING',
                                      name='datasettype',
                                      native_enum=False),
                              nullable=False,
                              comment='data type'),
                    sa.Column('path',
                              sa.String(length=512),
                              nullable=True,
                              comment='dataset path'),
                    sa.Column('cmt',
                              sa.Text(),
                              nullable=True,
                              comment='comment of dataset'),
                    sa.Column('created_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='created time'),
                    sa.Column('updated_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='updated time'),
                    sa.Column('deleted_at',
                              sa.DateTime(timezone=True),
                              nullable=True,
                              comment='deleted time'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', name='uniq_name'),
                    comment='This is webconsole dataset table',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_table('job_dependency_v2',
                    sa.Column('id',
                              sa.Integer(),
                              autoincrement=True,
                              nullable=False,
                              comment='id'),
                    sa.Column('src_job_id',
                              sa.Integer(),
                              nullable=True,
                              comment='src job id'),
                    sa.Column('dst_job_id',
                              sa.Integer(),
                              nullable=True,
                              comment='dst job id'),
                    sa.Column('dep_index',
                              sa.Integer(),
                              nullable=True,
                              comment='dep index'),
                    sa.PrimaryKeyConstraint('id'),
                    comment='record job dependencies',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_index('idx_dst_job_id',
                    'job_dependency_v2', ['dst_job_id'],
                    unique=False)
    op.create_index('idx_src_job_id',
                    'job_dependency_v2', ['src_job_id'],
                    unique=False)
    op.create_table('job_v2',
                    sa.Column('id',
                              sa.Integer(),
                              autoincrement=True,
                              nullable=False,
                              comment='id'),
                    sa.Column('name',
                              sa.String(length=255),
                              nullable=True,
                              comment='name'),
                    sa.Column('job_type',
                              sa.Enum('UNSPECIFIED',
                                      'RAW_DATA',
                                      'DATA_JOIN',
                                      'PSI_DATA_JOIN',
                                      'NN_MODEL_TRANINING',
                                      'TREE_MODEL_TRAINING',
                                      'NN_MODEL_EVALUATION',
                                      'TREE_MODEL_EVALUATION',
                                      name='jobtype',
                                      native_enum=False),
                              nullable=False,
                              comment='job type'),
                    sa.Column('state',
                              sa.Enum('INVALID',
                                      'STOPPED',
                                      'WAITING',
                                      'STARTED',
                                      name='jobstate',
                                      native_enum=False),
                              nullable=False,
                              comment='state'),
                    sa.Column('yaml_template',
                              sa.Text(),
                              nullable=True,
                              comment='yaml_template'),
                    sa.Column('config',
                              sa.LargeBinary(),
                              nullable=True,
                              comment='config'),
                    sa.Column('workflow_id',
                              sa.Integer(),
                              nullable=False,
                              comment='workflow id'),
                    sa.Column('project_id',
                              sa.Integer(),
                              nullable=False,
                              comment='project id'),
                    sa.Column('flapp_snapshot',
                              sa.Text(),
                              nullable=True,
                              comment='flapp snapshot'),
                    sa.Column('pods_snapshot',
                              sa.Text(),
                              nullable=True,
                              comment='pods snapshot'),
                    sa.Column('created_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='created at'),
                    sa.Column('updated_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='updated at'),
                    sa.Column('deleted_at',
                              sa.DateTime(timezone=True),
                              nullable=True,
                              comment='deleted at'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name'),
                    comment='webconsole job',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_index('idx_workflow_id', 'job_v2', ['workflow_id'], unique=False)
    op.create_table('projects_v2',
                    sa.Column('id',
                              sa.Integer(),
                              autoincrement=True,
                              nullable=False,
                              comment='id'),
                    sa.Column('name',
                              sa.String(length=255),
                              nullable=True,
                              comment='name'),
                    sa.Column('token',
                              sa.String(length=64),
                              nullable=True,
                              comment='token'),
                    sa.Column('config',
                              sa.LargeBinary(),
                              nullable=True,
                              comment='config'),
                    sa.Column('certificate',
                              sa.LargeBinary(),
                              nullable=True,
                              comment='certificate'),
                    sa.Column('cmt',
                              sa.Text(),
                              nullable=True,
                              comment='comment'),
                    sa.Column('created_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='created at'),
                    sa.Column('updated_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='updated at'),
                    sa.Column('deleted_at',
                              sa.DateTime(timezone=True),
                              nullable=True,
                              comment='deleted at'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', name='idx_name'),
                    comment='webconsole projects',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_index('idx_token', 'projects_v2', ['token'], unique=False)
    op.create_table('template_v2',
                    sa.Column('id', sa.Integer(), nullable=False,
                              comment='id'),
                    sa.Column('name',
                              sa.String(length=255),
                              nullable=True,
                              comment='name'),
                    sa.Column('cmt',
                              sa.String(length=255),
                              nullable=True,
                              comment='comment'),
                    sa.Column('group_alias',
                              sa.String(length=255),
                              nullable=False,
                              comment='group_alias'),
                    sa.Column('config',
                              sa.LargeBinary(),
                              nullable=False,
                              comment='config'),
                    sa.Column('is_left',
                              sa.Boolean(),
                              nullable=True,
                              comment='is_left'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', name='uniq_name'),
                    comment='workflow template',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_index('idx_group_alias',
                    'template_v2', ['group_alias'],
                    unique=False)
    op.create_table('users_v2',
                    sa.Column('id',
                              sa.Integer(),
                              nullable=False,
                              comment='user id'),
                    sa.Column('username',
                              sa.String(length=255),
                              nullable=True,
                              comment='user name of user'),
                    sa.Column('password',
                              sa.String(length=255),
                              nullable=True,
                              comment='user password after encode'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('username', name='uniq_username'),
                    comment='This is webconsole user table',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
    op.create_table('workflow_v2',
                    sa.Column('id', sa.Integer(), nullable=False,
                              comment='id'),
                    sa.Column('uuid',
                              sa.String(length=64),
                              nullable=True,
                              comment='uuid'),
                    sa.Column('name',
                              sa.String(length=255),
                              nullable=True,
                              comment='name'),
                    sa.Column('project_id',
                              sa.Integer(),
                              nullable=True,
                              comment='project_id'),
                    sa.Column('config',
                              sa.LargeBinary(),
                              nullable=True,
                              comment='config'),
                    sa.Column('cmt',
                              sa.String(length=255),
                              nullable=True,
                              comment='comment'),
                    sa.Column('metric_is_public',
                              sa.Boolean(),
                              nullable=False,
                              comment='metric_is_public'),
                    sa.Column('forkable',
                              sa.Boolean(),
                              nullable=True,
                              comment='forkable'),
                    sa.Column('forked_from',
                              sa.Integer(),
                              nullable=True,
                              comment='forked_from'),
                    sa.Column('reuse_job_names',
                              sa.TEXT(),
                              nullable=True,
                              comment='reuse_job_names'),
                    sa.Column('peer_reuse_job_names',
                              sa.TEXT(),
                              nullable=True,
                              comment='peer_reuse_job_names'),
                    sa.Column('fork_proposal_config',
                              sa.LargeBinary(),
                              nullable=True,
                              comment='fork_proposal_config'),
                    sa.Column('recur_type',
                              sa.Enum('NONE',
                                      'ON_NEW_DATA',
                                      'HOURLY',
                                      'DAILY',
                                      'WEEKLY',
                                      name='recurtype',
                                      native_enum=False),
                              nullable=True,
                              comment='recur_type'),
                    sa.Column('recur_at',
                              sa.Interval(),
                              nullable=True,
                              comment='recur_at'),
                    sa.Column('trigger_dataset',
                              sa.Integer(),
                              nullable=True,
                              comment='trigger_dataset'),
                    sa.Column('last_triggered_batch',
                              sa.Integer(),
                              nullable=True,
                              comment='last_triggered_batch'),
                    sa.Column('job_ids',
                              sa.TEXT(),
                              nullable=True,
                              comment='job_ids'),
                    sa.Column('state',
                              sa.Enum('INVALID',
                                      'NEW',
                                      'READY',
                                      'RUNNING',
                                      'STOPPED',
                                      name='workflow_state',
                                      native_enum=False),
                              nullable=True,
                              comment='state'),
                    sa.Column('target_state',
                              sa.Enum('INVALID',
                                      'NEW',
                                      'READY',
                                      'RUNNING',
                                      'STOPPED',
                                      name='workflow_target_state',
                                      native_enum=False),
                              nullable=True,
                              comment='target_state'),
                    sa.Column('transaction_state',
                              sa.Enum('READY',
                                      'ABORTED',
                                      'COORDINATOR_PREPARE',
                                      'COORDINATOR_COMMITTABLE',
                                      'COORDINATOR_COMMITTING',
                                      'COORDINATOR_ABORTING',
                                      'PARTICIPANT_PREPARE',
                                      'PARTICIPANT_COMMITTABLE',
                                      'PARTICIPANT_COMMITTING',
                                      'PARTICIPANT_ABORTING',
                                      name='transactionstate',
                                      native_enum=False),
                              nullable=True,
                              comment='transaction_state'),
                    sa.Column('transaction_err',
                              sa.Text(),
                              nullable=True,
                              comment='transaction_err'),
                    sa.Column('start_at',
                              sa.Integer(),
                              nullable=True,
                              comment='start_at'),
                    sa.Column('stop_at',
                              sa.Integer(),
                              nullable=True,
                              comment='stop_at'),
                    sa.Column('created_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='created_at'),
                    sa.Column('updated_at',
                              sa.DateTime(timezone=True),
                              server_default=sa.text('now()'),
                              nullable=True,
                              comment='update_at'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('name', name='uniq_name'),
                    sa.UniqueConstraint('uuid', name='uniq_uuid'),
                    comment='workflow_v2',
                    mysql_charset='utf8mb4',
                    mysql_engine='innodb')
def upgrade():
    """All tables to be created during the alembic upgrade process."""

    op.create_table('ssr_old_regions',
                    sa.Column('idbr_region',
                              sa.CHAR(length=2),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('ssr_reference',
                              sa.SMALLINT(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('region_name',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('idbr_region',
                                            name='ssr_old_regions_pkey'),
                    schema=schema_name)
    op.create_table('gor_regions',
                    sa.Column('idbr_region',
                              sa.CHAR(length=2),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('gor_reference',
                              sa.SMALLINT(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('region_name',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('idbr_region',
                                            name='gor_regions_pkey'),
                    schema=schema_name)
    op.create_table('vet',
                    sa.Column('vet_code',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('vet_description',
                              sa.VARCHAR(length=60),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('vet_code', name='vet_pkey'),
                    schema=schema_name)
    op.create_table('query_type',
                    sa.Column('query_type',
                              sa.VARCHAR(length=25),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('query_type_description',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('query_type',
                                            name='query_type_pkey'),
                    schema=schema_name,
                    postgresql_ignore_search_path=False)
    op.create_table('survey',
                    sa.Column('survey_code',
                              sa.CHAR(length=3),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('survey_name',
                              sa.VARCHAR(length=30),
                              autoincrement=False,
                              nullable=False),
                    sa.PrimaryKeyConstraint('survey_code', name='survey_pkey'),
                    schema=schema_name,
                    postgresql_ignore_search_path=False)
    op.create_table('contributor',
                    sa.Column('parent_ru_reference',
                              sa.VARCHAR(length=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('ru_reference',
                              sa.VARCHAR(length=11),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('house_name_number',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('street',
                              sa.VARCHAR(length=30),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('additional_address_line',
                              sa.VARCHAR(length=100),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('town_city',
                              sa.VARCHAR(length=30),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('county',
                              sa.VARCHAR(length=30),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('country',
                              sa.VARCHAR(length=30),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('postcode',
                              sa.VARCHAR(length=9),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('birth_date',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('business_profiling_team_case',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contact',
                              sa.VARCHAR(length=60),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('death_date',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('enforcement_flag',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('enforcement_status',
                              sa.VARCHAR(length=15),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('fax',
                              sa.VARCHAR(length=15),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contributor_name',
                              sa.VARCHAR(length=60),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('profile_information',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('sic2003',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('sic2007',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('telephone',
                              sa.VARCHAR(length=15),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('ru_reference',
                                            name='contributor_pkey'),
                    schema=schema_name,
                    postgresql_ignore_search_path=False)
    op.create_table(
        'survey_enrolment',
        sa.Column('ru_reference',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_code',
                  sa.CHAR(length=3),
                  autoincrement=False,
                  nullable=False),
        sa.Column('number_of_consecutive_non_response',
                  sa.SMALLINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('number_of_periods_without_queries',
                  sa.SMALLINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('period_of_enrolment',
                  sa.VARCHAR(length=10),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(['ru_reference'],
                                ['es_db_test.contributor.ru_reference'],
                                name='survey_enrolment_ru_reference_fkey'),
        sa.ForeignKeyConstraint(['survey_code'],
                                ['es_db_test.survey.survey_code'],
                                name='survey_enrolment_survey_code_fkey'),
        sa.PrimaryKeyConstraint('ru_reference',
                                'survey_code',
                                name='survey_enrolment_pkey'),
        schema=schema_name,
        postgresql_ignore_search_path=False)
    op.create_table('survey_period',
                    sa.Column('survey_period',
                              sa.CHAR(length=6),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('survey_code',
                              sa.CHAR(length=3),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('active_period',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('number_of_responses',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('number_cleared',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('sample_size',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('number_cleared_first_time',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['survey_code'], ['es_db_test.survey.survey_code'],
                        name='survey_period_survey_code_fkey'),
                    sa.PrimaryKeyConstraint('survey_period',
                                            'survey_code',
                                            name='survey_period_pkey'),
                    schema=schema_name,
                    postgresql_ignore_search_path=False)
    op.create_table('contributor_survey_period',
                    sa.Column('ru_reference',
                              sa.VARCHAR(length=11),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('survey_code',
                              sa.CHAR(length=3),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('survey_period',
                              sa.VARCHAR(length=6),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('run_id',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('additional_comments',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contributor_comments',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('last_updated',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('active_queries',
                              sa.SMALLINT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contributor_interactions',
                              sa.SMALLINT(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('priority_response_list',
                              sa.VARCHAR(length=100),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('response_status',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('short_description',
                              sa.VARCHAR(length=50),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('status_changed',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(
                        ['ru_reference', 'survey_code'], [
                            'es_db_test.survey_enrolment.ru_reference',
                            'es_db_test.survey_enrolment.survey_code'
                        ],
                        name='contributor_survey_period_ru_reference_fkey'),
                    sa.ForeignKeyConstraint(
                        ['survey_code', 'survey_period'], [
                            'es_db_test.survey_period.survey_code',
                            'es_db_test.survey_period.survey_period'
                        ],
                        name='contributor_survey_period_survey_code_fkey'),
                    sa.PrimaryKeyConstraint(
                        'ru_reference',
                        'survey_code',
                        'survey_period',
                        name='contributor_survey_period_pkey'),
                    schema=schema_name,
                    postgresql_ignore_search_path=False)
    op.create_table('contact',
                    sa.Column('contact_reference',
                              sa.VARCHAR(length=25),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('house_name_number',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('street',
                              sa.VARCHAR(length=30),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('additional_address_line',
                              sa.VARCHAR(length=50),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('town_city',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('county',
                              sa.VARCHAR(length=15),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('country',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('postcode',
                              sa.VARCHAR(length=9),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('contact_constraints',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contact_email',
                              sa.VARCHAR(length=50),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contact_fax',
                              sa.VARCHAR(length=12),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contact_name',
                              sa.VARCHAR(length=50),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('contact_organisation',
                              sa.VARCHAR(length=50),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('contact_preferences',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('contact_telephone',
                              sa.VARCHAR(length=12),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('contact_reference',
                                            name='contact_pkey'),
                    schema=schema_name)
    op.create_table(
        'survey_contact',
        sa.Column('contact_reference',
                  sa.VARCHAR(length=15),
                  autoincrement=False,
                  nullable=False),
        sa.Column('ru_reference',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_code',
                  sa.CHAR(length=3),
                  autoincrement=False,
                  nullable=False),
        sa.Column('effective_end_date',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('effective_start_date',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(['contact_reference'],
                                ['es_db_test.contact.contact_reference'],
                                name='survey_contact_contact_reference_fkey'),
        sa.ForeignKeyConstraint(['ru_reference', 'survey_code'], [
            'es_db_test.survey_enrolment.ru_reference',
            'es_db_test.survey_enrolment.survey_code'
        ],
                                name='survey_contact_ru_reference_fkey'),
        sa.PrimaryKeyConstraint('contact_reference',
                                'ru_reference',
                                'survey_code',
                                name='survey_contact_pkey'),
        schema=schema_name)
    op.create_table(
        'query',
        sa.Column('query_reference',
                  sa.INTEGER(),
                  server_default=sa.text(
                      "nextval('es_db_test.query_queryreference_" +
                      "seq'::regclass)"),
                  autoincrement=True,
                  nullable=False),
        sa.Column('query_type',
                  sa.VARCHAR(length=25),
                  autoincrement=False,
                  nullable=False),
        sa.Column('ru_reference',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_code',
                  sa.CHAR(length=3),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_period',
                  sa.CHAR(length=6),
                  autoincrement=False,
                  nullable=False),
        sa.Column('current_period',
                  sa.VARCHAR(length=6),
                  autoincrement=False,
                  nullable=False),
        sa.Column('date_raised',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('general_specific_flag',
                  sa.BOOLEAN(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('industry_group',
                  sa.VARCHAR(length=20),
                  autoincrement=False,
                  nullable=True),
        sa.Column('last_query_update',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('query_active',
                  sa.BOOLEAN(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('query_description',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('query_status',
                  sa.VARCHAR(length=25),
                  autoincrement=False,
                  nullable=False),
        sa.Column('raised_by',
                  sa.VARCHAR(length=30),
                  autoincrement=False,
                  nullable=False),
        sa.Column('results_state',
                  sa.VARCHAR(length=15),
                  autoincrement=False,
                  nullable=True),
        sa.Column('target_resolution_date',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['survey_period', 'ru_reference', 'survey_code'], [
                'es_db_test.contributor_survey_period.survey_period',
                'es_db_test.contributor_survey_period.ru_reference',
                'es_db_test.contributor_survey_period.survey_code'
            ],
            name='query_survey_period_fkey'),
        sa.ForeignKeyConstraint(['query_type'],
                                ['es_db_test.query_type.query_type'],
                                name='query_query_type_fkey'),
        sa.PrimaryKeyConstraint('query_reference', name='query_pkey'),
        schema=schema_name,
        postgresql_ignore_search_path=False)
    op.create_table(
        'query_task',
        sa.Column('task_sequence_number',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('query_reference',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('response_required_by',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('task_description',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('task_responsibility',
                  sa.VARCHAR(length=50),
                  autoincrement=False,
                  nullable=True),
        sa.Column('task_status',
                  sa.VARCHAR(length=20),
                  autoincrement=False,
                  nullable=False),
        sa.Column('next_planned_action',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('when_action_required',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['query_reference'],
                                ['es_db_test.query.query_reference'],
                                name='query_task_query_reference_fkey'),
        sa.PrimaryKeyConstraint('task_sequence_number',
                                'query_reference',
                                name='query_task_pkey'),
        schema=schema_name,
        postgresql_ignore_search_path=False)
    op.create_table('query_task_update',
                    sa.Column('task_sequence_number',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('query_reference',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('last_updated',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('task_update_description',
                              sa.VARCHAR(length=50),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('updated_by',
                              sa.VARCHAR(length=20),
                              autoincrement=False,
                              nullable=False),
                    sa.ForeignKeyConstraint(
                        ['task_sequence_number', 'query_reference'], [
                            'es_db_test.query_task.task_sequence_number',
                            'es_db_test.query_task.query_reference'
                        ],
                        name='query_task_update_task_sequence_number_fkey'),
                    sa.PrimaryKeyConstraint('task_sequence_number',
                                            'query_reference',
                                            'last_updated',
                                            name='query_task_update_pkey'),
                    schema=schema_name)
    op.create_table(
        'step_exception',
        sa.Column('query_reference',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_period',
                  sa.VARCHAR(length=6),
                  autoincrement=False,
                  nullable=False),
        sa.Column('run_id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('ru_reference',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('step',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_code',
                  sa.CHAR(length=3),
                  autoincrement=False,
                  nullable=False),
        sa.Column('error_code',
                  sa.VARCHAR(length=10),
                  autoincrement=False,
                  nullable=False),
        sa.Column('error_description',
                  sa.VARCHAR(length=60),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(['query_reference'],
                                ['es_db_test.query.query_reference'],
                                name='step_exception_query_reference_fkey'),
        sa.ForeignKeyConstraint(
            ['survey_period', 'ru_reference', 'survey_code'], [
                'es_db_test.contributor_survey_period.survey_period',
                'es_db_test.contributor_survey_period.ru_reference',
                'es_db_test.contributor_survey_period.survey_code'
            ],
            name='step_exception_survey_period_fkey'),
        sa.PrimaryKeyConstraint('survey_period',
                                'run_id',
                                'ru_reference',
                                'step',
                                'survey_code',
                                name='step_exception_pkey'),
        schema=schema_name,
        postgresql_ignore_search_path=False)
    op.create_table(
        'question_anomaly',
        sa.Column('survey_period',
                  sa.VARCHAR(length=6),
                  autoincrement=False,
                  nullable=False),
        sa.Column('question_number',
                  sa.VARCHAR(length=8),
                  autoincrement=False,
                  nullable=False),
        sa.Column('run_id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('ru_reference',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('step',
                  sa.VARCHAR(length=10),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_code',
                  sa.CHAR(length=3),
                  autoincrement=False,
                  nullable=False),
        sa.Column('anomaly_description',
                  sa.VARCHAR(length=20),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['survey_period', 'run_id', 'ru_reference', 'step', 'survey_code'],
            [
                'es_db_test.step_exception.survey_period',
                'es_db_test.step_exception.run_id',
                'es_db_test.step_exception.ru_reference',
                'es_db_test.step_exception.step',
                'es_db_test.step_exception.survey_code'
            ],
            name='question_anomaly_survey_period_fkey'),
        sa.PrimaryKeyConstraint('survey_period',
                                'question_number',
                                'run_id',
                                'ru_reference',
                                'step',
                                'survey_code',
                                name='question_anomaly_pkey'),
        schema=schema_name)
    op.create_table(
        'failed_vet',
        sa.Column('failed_vet',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_period',
                  sa.VARCHAR(length=6),
                  autoincrement=False,
                  nullable=False),
        sa.Column('question_number',
                  sa.VARCHAR(length=4),
                  autoincrement=False,
                  nullable=False),
        sa.Column('run_id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('ru_reference',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('step',
                  sa.VARCHAR(length=11),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_code',
                  sa.VARCHAR(length=25),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(['failed_vet'], ['es_db_test.vet.vet_code'],
                                name='failed_vet_failed_vet_fkey'),
        sa.ForeignKeyConstraint([
            'survey_period', 'question_number', 'run_id', 'ru_reference',
            'step', 'survey_code'
        ], [
            'es_db_test.question_anomaly.survey_period',
            'es_db_test.question_anomaly.question_number',
            'es_db_test.question_anomaly.run_id',
            'es_db_test.question_anomaly.ru_reference',
            'es_db_test.question_anomaly.step',
            'es_db_test.question_anomaly.survey_code'
        ],
                                name='failed_vet_survey_period_fkey'),
        sa.PrimaryKeyConstraint('failed_vet',
                                'survey_period',
                                'question_number',
                                'run_id',
                                'ru_reference',
                                'step',
                                'survey_code',
                                name='failed_vet_pkey'),
        schema=schema_name)
Esempio n. 17
0
def downgrade():
    with op.batch_alter_table('kronos_gateway') as batch_op:
        batch_op.alter_column('uid',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('type',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('softwareVersion',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('softwareName',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('sdkVersion',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('osName',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('name',
                   existing_type=sa.TEXT(),
                   nullable=False)
    with op.batch_alter_table('kronos_device') as batch_op:
        batch_op.alter_column('uid',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('type',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('softwareVersion',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('softwareName',
                   existing_type=sa.TEXT(),
                   nullable=False)
        batch_op.alter_column('name',
                   existing_type=sa.TEXT(),
                   nullable=False)
Esempio n. 18
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'oauth2_clients',
        sa.Column('contact', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('policy_uri', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('redirect_uri',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('grant_type', sa.TEXT(), autoincrement=False,
                  nullable=False))
    op.add_column(
        'oauth2_clients',
        sa.Column('jwks_text', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('issued_at',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False))
    op.add_column(
        'oauth2_clients',
        sa.Column('expires_at',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False))
    op.add_column(
        'oauth2_clients',
        sa.Column('i18n_metadata',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('jwks_uri', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('client_uri', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('scope', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column(
        'oauth2_clients',
        sa.Column('logo_uri', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('software_version',
                  sa.VARCHAR(length=48),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('response_type',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False))
    op.add_column(
        'oauth2_clients',
        sa.Column('software_id',
                  sa.VARCHAR(length=36),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('token_endpoint_auth_method',
                  sa.VARCHAR(length=48),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('tos_uri', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column(
        'oauth2_clients',
        sa.Column('client_name',
                  sa.VARCHAR(length=100),
                  autoincrement=False,
                  nullable=True))
    op.drop_column('oauth2_clients', 'client_secret_expires_at')
    op.drop_column('oauth2_clients', 'client_metadata')
    op.drop_column('oauth2_clients', 'client_id_issued_at')
    op.drop_column('oauth2_authorization_codes', 'nonce')
    op.drop_table('authorized_clients')
Esempio n. 19
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'job', sa.Column('filename', sa.TEXT(), nullable=True))
    op.add_column(u'job', sa.Column('type', sa.TEXT(), nullable=True))
    op.drop_table('data_set')
Esempio n. 20
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user', 'password',
               existing_type=sa.Binary(),
               type_=sa.TEXT(),
               existing_nullable=True)
Esempio n. 21
0
def downgrade_data():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'DetailItem',
        sa.Column('id',
                  sa.INTEGER(),
                  server_default=sa.text(
                      'nextval(\'"DetailItem_id_seq"\'::regclass)'),
                  nullable=False),
        sa.Column('itemid', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('quote', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('sku', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('rating_count',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('warranty', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('seller_name', sa.TEXT(), autoincrement=False,
                  nullable=True),
        sa.Column('question_count',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('positive_rating',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('json_data', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('seller_data', sa.TEXT(), autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='DetailItem_pkey'),
        sa.UniqueConstraint('itemid', name='DetailItem_itemid_key'))
    op.create_table(
        'QAItem',
        sa.Column(
            'id',
            sa.INTEGER(),
            server_default=sa.text('nextval(\'"QAItem_id_seq"\'::regclass)'),
            nullable=False),
        sa.Column('itemid', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('question', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('question_date',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('question_author',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('answer', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('answer_author',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('answer_date', sa.TEXT(), autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='QAItem_pkey'),
        sa.UniqueConstraint('itemid', name='QAItem_itemid_key'))
    op.create_table(
        'ReviewItem',
        sa.Column('id',
                  sa.INTEGER(),
                  server_default=sa.text(
                      'nextval(\'"ReviewItem_id_seq"\'::regclass)'),
                  nullable=False),
        sa.Column('itemid', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('review_title',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('rating', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('review_date', sa.TEXT(), autoincrement=False,
                  nullable=True),
        sa.Column('reviewer', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('review_text', sa.TEXT(), autoincrement=False,
                  nullable=True),
        sa.Column('upvode', sa.TEXT(), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('id', name='ReviewItem_pkey'),
        sa.UniqueConstraint('itemid', name='ReviewItem_itemid_key'))
    op.create_table(
        'MiniItem',
        sa.Column(
            'id',
            sa.INTEGER(),
            server_default=sa.text('nextval(\'"MiniItem_id_seq"\'::regclass)'),
            nullable=False),
        sa.Column('itemid', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('sku', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('price', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('originalprice',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('country', sa.TEXT(), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('id', name='MiniItem_pkey'),
        sa.UniqueConstraint('itemid', name='MiniItem_itemid_key'))
    op.drop_table('reviewitem')
    op.drop_table('qaitem')
    op.drop_table('miniitem')
    op.drop_table('detailitem')
def upgrade():
    op.add_column(
        'stop_time', sa.Column('headsign', sa.TEXT(), primary_key=False, nullable=True), schema='navitia'
    )
Esempio n. 23
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('writingscripts',
                    sa.Column('script_id', sa.INTEGER(), nullable=False),
                    sa.Column('name', sa.TEXT(), nullable=True),
                    sa.Column('code', sa.VARCHAR(length=4), nullable=False),
                    sa.Column('n_code', sa.VARCHAR(length=3), nullable=False),
                    sa.PrimaryKeyConstraint('script_id'),
                    sa.UniqueConstraint('code'), sa.UniqueConstraint('n_code'),
                    sa.UniqueConstraint('name'))
    op.create_table(
        'dialects', sa.Column('dialect_id', sa.INTEGER(), nullable=False),
        sa.Column('name', sa.TEXT(), nullable=False),
        sa.Column('language_code', sa.CHAR(length=3), nullable=False),
        sa.Column('country_code', sa.CHAR(length=3), nullable=False),
        sa.Column('script_id', sa.INTEGER(), nullable=False),
        sa.Column('ltr', sa.BOOLEAN(), nullable=False),
        sa.Column('romanization_scheme', sa.TEXT(), nullable=True),
        sa.ForeignKeyConstraint(
            ['script_id'],
            ['writingscripts.script_id'],
        ), sa.PrimaryKeyConstraint('dialect_id'))
    op.create_table(
        'alphabets', sa.Column('alphabet_id', sa.INTEGER(), nullable=False),
        sa.Column('name', sa.TEXT(), nullable=False),
        sa.Column('dialect_id', sa.INTEGER(), nullable=False),
        sa.Column('active',
                  sa.BOOLEAN(),
                  server_default=sa.text(u'TRUE'),
                  nullable=False),
        sa.Column('manual_url', sa.TEXT(), nullable=True),
        sa.ForeignKeyConstraint(
            ['dialect_id'],
            ['dialects.dialect_id'],
        ), sa.PrimaryKeyConstraint('alphabet_id'), sa.UniqueConstraint('name'))
    op.create_table(
        'graphemes', sa.Column('grapheme_id', sa.INTEGER(), nullable=False),
        sa.Column('key', sa.TEXT(), nullable=False),
        sa.Column('alphabet_id', sa.INTEGER(), nullable=False),
        sa.Column('token', sa.TEXT(), nullable=False),
        sa.Column('orthography', sa.TEXT(), nullable=True),
        sa.Column('romanization', sa.TEXT(), nullable=True),
        sa.Column('sample_word', sa.TEXT(), nullable=True),
        sa.Column('sample_transcription', sa.TEXT(), nullable=True),
        sa.Column('sample_romanization', sa.TEXT(), nullable=True),
        sa.ForeignKeyConstraint(
            ['alphabet_id'],
            ['alphabets.alphabet_id'],
        ), sa.PrimaryKeyConstraint('grapheme_id'),
        sa.UniqueConstraint('alphabet_id', 'key'),
        sa.UniqueConstraint('alphabet_id', 'token'))
    op.create_table(
        'rules', sa.Column('rule_id', sa.INTEGER(), nullable=False),
        sa.Column('name', sa.TEXT(), nullable=False),
        sa.Column('type', sa.TEXT(), nullable=False),
        sa.Column('description', sa.TEXT(), nullable=True),
        sa.Column('alphabet_id', sa.INTEGER(), nullable=False),
        sa.CheckConstraint(
            u"type=ANY(ARRAY['phonology','stress','syllabification','vowelisation'])"
        ), sa.ForeignKeyConstraint(
            ['alphabet_id'],
            ['alphabets.alphabet_id'],
        ), sa.PrimaryKeyConstraint('rule_id'),
        sa.UniqueConstraint('name', 'alphabet_id'))
    op.create_table('rule_patterns',
                    sa.Column('regex_id', sa.INTEGER(), nullable=False),
                    sa.Column('rule_id', sa.INTEGER(), nullable=False),
                    sa.Column('search', sa.TEXT(), nullable=False),
                    sa.Column('replace', sa.TEXT(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['rule_id'],
                        ['rules.rule_id'],
                    ), sa.PrimaryKeyConstraint('regex_id'))
Esempio n. 24
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'maintenance', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('provider_maintenance_id',
                  sa.String(length=128),
                  nullable=True), sa.Column('start', sa.TIME(), nullable=True),
        sa.Column('end', sa.TIME(), nullable=True),
        sa.Column('timezone', sa.String(length=128), nullable=True),
        sa.Column('cancelled', sa.INTEGER(), nullable=True),
        sa.Column('rescheduled', sa.INTEGER(), nullable=True),
        sa.Column('rescheduled_id', sa.Integer(), nullable=True),
        sa.Column('location', sa.String(length=2048), nullable=True),
        sa.Column('reason', sa.TEXT(), nullable=True),
        sa.Column('received_dt', sa.DateTime(), nullable=True),
        sa.Column('started', sa.INTEGER(), nullable=True),
        sa.Column('ended', sa.INTEGER(), nullable=True),
        sa.ForeignKeyConstraint(
            ['rescheduled_id'],
            ['maintenance.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_maintenance_location'),
                    'maintenance', ['location'],
                    unique=False)
    op.create_table(
        'provider', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=128), nullable=True),
        sa.Column('type',
                  sa.Enum('transit',
                          'backbone',
                          'transport',
                          'peering',
                          'facility',
                          'multi',
                          name='ProviderType'),
                  nullable=True),
        sa.Column('email_esc', sa.VARCHAR(length=128), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_provider_name'),
                    'provider', ['name'],
                    unique=False)
    op.create_table(
        'circuit', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('provider_cid', sa.VARCHAR(length=128), nullable=True),
        sa.Column('a_side', sa.VARCHAR(length=128), nullable=True),
        sa.Column('z_side', sa.VARCHAR(length=128), nullable=True),
        sa.Column('provider_id', sa.Integer(), nullable=True),
        sa.Column('contract_filename', sa.String(length=256), nullable=True),
        sa.ForeignKeyConstraint(
            ['provider_id'],
            ['provider.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_circuit_provider_cid'),
                    'circuit', ['provider_cid'],
                    unique=True)
    op.create_table(
        'maint_update', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('maintenance_id', sa.Integer(), nullable=True),
        sa.Column('comment', sa.TEXT(), nullable=True),
        sa.Column('updated', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ['maintenance_id'],
            ['maintenance.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'maint_circuit', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('maint_id', sa.Integer(), nullable=True),
        sa.Column('circuit_id', sa.Integer(), nullable=True),
        sa.Column('impact', sa.VARCHAR(length=128), nullable=True),
        sa.Column('date', sa.DATE(), nullable=True),
        sa.ForeignKeyConstraint(
            ['circuit_id'],
            ['circuit.id'],
        ), sa.ForeignKeyConstraint(
            ['maint_id'],
            ['maintenance.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.drop_index('ix_apscheduler_jobs_next_run_time',
                  table_name='apscheduler_jobs')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'investigated_file',
        sa.Column('package_analyzer_run_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('python_file_digest_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['package_analyzer_run_id'], ['package_analyzer_run.id'],
            name='investigated_file_package_analyzer_run_id_fkey',
            ondelete='CASCADE'),
        sa.ForeignKeyConstraint(
            ['python_file_digest_id'], ['python_file_digest.id'],
            name='investigated_file_python_file_digest_id_fkey',
            ondelete='CASCADE'))
    op.create_table(
        'package_analyzer_run',
        sa.Column('id',
                  sa.INTEGER(),
                  server_default=sa.text(
                      "nextval('package_analyzer_run_id_seq'::regclass)"),
                  autoincrement=True,
                  nullable=False),
        sa.Column('package_analyzer_name',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('package_analyzer_version',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('package_analysis_document_id',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('datetime',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('debug', sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.Column('package_analyzer_error',
                  sa.BOOLEAN(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('duration', sa.INTEGER(), autoincrement=False,
                  nullable=True),
        sa.Column('input_python_package_version_entity_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['input_python_package_version_entity_id'],
            ['python_package_version_entity.id'],
            name=
            'package_analyzer_run_input_python_package_version_entity_i_fkey',
            ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id', name='package_analyzer_run_pkey'),
        postgresql_ignore_search_path=False)
    op.create_table(
        'investigated',
        sa.Column('package_analyzer_run_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('python_artifact_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['package_analyzer_run_id'], ['package_analyzer_run.id'],
            name='investigated_package_analyzer_run_id_fkey',
            ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['python_artifact_id'], ['python_artifact.id'],
                                name='investigated_python_artifact_id_fkey',
                                ondelete='CASCADE'))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('introduction', sa.TEXT(), autoincrement=False, nullable=True))
    op.drop_column('users', 'about_me')
Esempio n. 27
0
def upgrade():
    op.add_column('alarmtypes', sa.Column('attributes', sa.TEXT(), nullable=True, default=""))
    op.add_column('alarmsections', sa.Column('attributes', sa.TEXT(), nullable=True, default=""))
Esempio n. 28
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    op.add_column(
        'markers',
        sa.Column('home', sa.INTEGER(), autoincrement=False, nullable=True))
    op.drop_column('markers', 'house_number')
    op.add_column(
        'involved',
        sa.Column('home_residence_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True))
    op.drop_column('involved', 'home_yishuv_shape')
    op.add_column(
        'injured_around_school_all_data',
        sa.Column('markers_home',
                  postgresql.DOUBLE_PRECISION(precision=53),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'injured_around_school_all_data',
        sa.Column('involved_home_residence_type',
                  postgresql.DOUBLE_PRECISION(precision=53),
                  autoincrement=False,
                  nullable=True))
    op.drop_column('injured_around_school_all_data', 'markers_house_number')
    op.drop_column('injured_around_school_all_data',
                   'involved_home_yishuv_shape')
    op.create_table(
        'involved_no_location',
        sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column('provider_and_id',
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('provider_code',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('accident_id',
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('involved_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('license_acquiring_date',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('age_group',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('sex', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('safety_measures',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('involve_yishuv_symbol',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('injury_severity',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('injured_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('injured_position',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('population_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('home_region',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('home_district',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('home_natural_area',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('home_municipal_status',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('home_residence_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('hospital_time',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('medical_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('release_dest',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('safety_measures_use',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('late_deceased',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('car_id', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('involve_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('accident_year',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('accident_month',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('vehicle_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('injury_severity_mais',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='involved_no_location_pkey'))
    op.create_index('provider_and_id_idx_involved_no_location',
                    'involved_no_location', ['provider_and_id'],
                    unique=False)
    op.create_index('accident_id_idx_involved_no_location',
                    'involved_no_location', ['accident_id'],
                    unique=False)
    op.create_table('markers_no_location',
                    sa.Column('latitude',
                              postgresql.DOUBLE_PRECISION(precision=53),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('longitude',
                              postgresql.DOUBLE_PRECISION(precision=53),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('type',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('title',
                              sa.VARCHAR(length=100),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('created',
                              postgresql.TIMESTAMP(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('id',
                              sa.BIGINT(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('provider_and_id',
                              sa.BIGINT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('provider_code',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('description',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('address',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('mainStreet',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('secondaryStreet',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('junction',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('one_lane',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('multi_lane',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('speed_limit',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_width',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_sign',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_light',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_control',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('weather',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_surface',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_object',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('object_distance',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('didnt_cross',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('cross_mode',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('cross_location',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('cross_direction',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('video_link',
                              sa.TEXT(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road1',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road2',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('km',
                              postgresql.DOUBLE_PRECISION(precision=53),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('yishuv_symbol',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('geo_area',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('day_night',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('day_in_week',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('traffic_light',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('region',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('district',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('natural_area',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('yishuv_shape',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('street1',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('street2',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('home',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('urban_intersection',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('non_urban_intersection',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_year',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_month',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_day',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_hour_raw',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_hour',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_minute',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_severity',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('accident_type',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('day_type',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('location_accuracy',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('police_unit',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_intactness',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_shape',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('road_type',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('municipal_status',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id',
                                            'provider_code',
                                            name='markers_no_location_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_index('provider_and_id_idx_markers_no_location',
                    'markers_no_location', ['provider_and_id'],
                    unique=True)
    op.create_index('ix_markers_no_location_created',
                    'markers_no_location', ['created'],
                    unique=False)
    op.create_index('id_idx_markers_no_location',
                    'markers_no_location', ['id'],
                    unique=False)
    op.create_table(
        'injury_severity_mais',
        sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('year', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('provider_code',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('injury_severity_mais_hebrew',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id',
                                'year',
                                'provider_code',
                                name='injury_severity_mais_pkey'))
    op.create_index('ix_injury_severity_mais_year',
                    'injury_severity_mais', ['year'],
                    unique=False)
    op.create_index('ix_injury_severity_mais_provider_code',
                    'injury_severity_mais', ['provider_code'],
                    unique=False)
    op.create_index('ix_injury_severity_mais_id',
                    'injury_severity_mais', ['id'],
                    unique=False)
    op.create_table(
        'vehicles_no_location',
        sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column('provider_and_id',
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('provider_code',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('accident_id',
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('engine_volume',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('manufacturing_year',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('driving_directions',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('vehicle_status',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('vehicle_attribution',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('vehicle_type',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('seats', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('total_weight',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('accident_month',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('accident_year',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('car_id', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('vehicle_damage',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='vehicles_no_location_pkey'))
    op.create_index('provider_and_id_idx_vehicles_no_location',
                    'vehicles_no_location', ['provider_and_id'],
                    unique=False)
    op.create_index('accident_id_idx_vehicles_no_location',
                    'vehicles_no_location', ['accident_id'],
                    unique=False)
Esempio n. 29
0
def downgrade():
    op.add_column(
        'survey',
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False))
    op.add_column(
        'subprocess',
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False))
    op.add_column(
        'process',
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False))
    op.add_column(
        'measure',
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False))
    op.add_column(
        'function',
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False))
    op.add_column(
        'assessment',
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False))
    op.create_table(
        'measure_history',
        sa.Column('id', postgresql.UUID(), autoincrement=False,
                  nullable=False),
        sa.Column('subprocess_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('seq', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('title', sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column('weight',
                  postgresql.DOUBLE_PRECISION(precision=53),
                  autoincrement=False,
                  nullable=False),
        sa.Column('intent', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('inputs', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('scenario', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('questions', sa.TEXT(), autoincrement=False, nullable=True),
        sa.Column('response_type',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('changed',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('survey_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.PrimaryKeyConstraint('id', 'version', name='measure_history_pkey'))
    op.create_table(
        'survey_history',
        sa.Column('id', postgresql.UUID(), autoincrement=False,
                  nullable=False),
        sa.Column('created',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('title', sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('changed',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', 'version', name='survey_history_pkey'))
    op.create_table(
        'function_history',
        sa.Column('id', postgresql.UUID(), autoincrement=False,
                  nullable=False),
        sa.Column('seq', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('title', sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column('description',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('changed',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('survey_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.PrimaryKeyConstraint('id', 'version', name='function_history_pkey'))
    op.create_table(
        'subprocess_history',
        sa.Column('id', postgresql.UUID(), autoincrement=False,
                  nullable=False),
        sa.Column('process_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('seq', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('title', sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column('description',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('changed',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('survey_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.PrimaryKeyConstraint('id',
                                'version',
                                name='subprocess_history_pkey'))
    op.create_table(
        'process_history',
        sa.Column('id', postgresql.UUID(), autoincrement=False,
                  nullable=False),
        sa.Column('function_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('seq', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('title', sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column('description',
                  sa.TEXT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('changed',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('survey_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.PrimaryKeyConstraint('id', 'version', name='process_history_pkey'))
    op.create_table(
        'assessment_history',
        sa.Column('id', postgresql.UUID(), autoincrement=False,
                  nullable=False),
        sa.Column('organisation_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('survey_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('measureset_id',
                  postgresql.UUID(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('approval', sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column('created',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('changed',
                  postgresql.TIMESTAMP(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id',
                                'version',
                                name='assessment_history_pkey'))
Esempio n. 30
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("activity",
                  sa.Column("creation_comment", sa.TEXT(), nullable=True))