def downgrade():
    op.alter_column('roles_version',
                    'permissions',
                    existing_type=sa.BigInteger(),
                    type_=sa.Integer())
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'geolocation', sa.Column('geolocation_id',
                                 sa.Integer(),
                                 nullable=False),
        sa.Column('latitude',
                  sa.DECIMAL(precision=10, scale=8),
                  nullable=False),
        sa.Column('longitude',
                  sa.DECIMAL(precision=11, scale=8),
                  nullable=False), sa.PrimaryKeyConstraint('geolocation_id'))
    op.create_table(
        'locale_link',
        sa.Column('link_id', sa.String(length=36), nullable=False),
        sa.Column('link_locale',
                  sa.Enum('ru', 'en', name='language'),
                  nullable=False),
        sa.Column('link_path', sa.Text(), nullable=False),
        sa.PrimaryKeyConstraint('link_id', 'link_locale'))
    op.create_table(
        'locale_string',
        sa.Column('string_id', sa.String(length=36), nullable=False),
        sa.Column('string_locale',
                  sa.Enum('ru', 'en', name='language'),
                  nullable=False),
        sa.Column('string_content', sa.Text(), nullable=False),
        sa.PrimaryKeyConstraint('string_id', 'string_locale'))
    op.create_table(
        'role', sa.Column('role_id', sa.Integer(), nullable=False),
        sa.Column('role_name',
                  sa.Enum('content_moder',
                          'user_moder',
                          'user',
                          name='rolename'),
                  nullable=False), sa.PrimaryKeyConstraint('role_id'))
    op.create_table(
        'user', sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('user_name', sa.String(length=100), nullable=False),
        sa.Column('user_password', sa.String(length=100), nullable=False),
        sa.Column('user_email', sa.String(length=200), nullable=False),
        sa.Column('is_active',
                  sa.Boolean(),
                  server_default='1',
                  nullable=False),
        sa.Column('user_image', sa.String(length=41), nullable=True),
        sa.PrimaryKeyConstraint('user_id'))
    op.create_table(
        'category', sa.Column('category_id', sa.Integer(), nullable=False),
        sa.Column('category_alias', sa.String(length=30), nullable=False),
        sa.Column('category_name_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(
            ['category_name_id'],
            ['locale_string.string_id'],
        ), sa.PrimaryKeyConstraint('category_id'))
    op.create_table(
        'city', sa.Column('city_id', sa.Integer(), nullable=False),
        sa.Column('city_name_id', sa.String(length=36), nullable=False),
        sa.Column('city_image_link', sa.String(length=250), nullable=False),
        sa.Column('city_description_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(
            ['city_description_id'],
            ['locale_string.string_id'],
        ),
        sa.ForeignKeyConstraint(
            ['city_name_id'],
            ['locale_string.string_id'],
        ), sa.PrimaryKeyConstraint('city_id'))
    op.create_table('user_role',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('role_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['role_id'],
                        ['role.role_id'],
                    ), sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.user_id'],
                    ), sa.PrimaryKeyConstraint('user_id', 'role_id'))
    op.create_table(
        'entity', sa.Column('entity_id', sa.Integer(), nullable=False),
        sa.Column('entity_type',
                  sa.Enum('entity',
                          'object',
                          'place',
                          'public_place',
                          'historical_person',
                          'route',
                          name='entitytype'),
                  nullable=False),
        sa.Column('entity_city_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['entity_city_id'],
            ['city.city_id'],
        ), sa.PrimaryKeyConstraint('entity_id'))
    op.create_table(
        'object', sa.Column('object_id', sa.Integer(), nullable=False),
        sa.Column('object_image_link', sa.String(length=250), nullable=False),
        sa.Column('object_audioguide_link_id',
                  sa.String(length=36),
                  nullable=True),
        sa.Column('object_description_id',
                  sa.String(length=36),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['object_audioguide_link_id'],
            ['locale_link.link_id'],
        ),
        sa.ForeignKeyConstraint(
            ['object_description_id'],
            ['locale_string.string_id'],
        ), sa.ForeignKeyConstraint(
            ['object_id'],
            ['entity.entity_id'],
        ), sa.PrimaryKeyConstraint('object_id'))
    op.create_table(
        'review', sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('entity_id', sa.Integer(), nullable=False),
        sa.Column('review_rating', sa.SMALLINT(), nullable=False),
        sa.Column('review_time',
                  sa.DateTime(),
                  nullable=False,
                  server_default=sa.func.current_timestamp()),
        sa.Column('review_text', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(
            ['entity_id'],
            ['entity.entity_id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.user_id'],
        ), sa.PrimaryKeyConstraint('user_id', 'entity_id'))
    op.create_table(
        'route', sa.Column('route_id', sa.Integer(), nullable=False),
        sa.Column('route_name_id', sa.String(length=36), nullable=False),
        sa.Column('route_description_id', sa.String(length=36),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['route_description_id'],
            ['locale_string.string_id'],
        ), sa.ForeignKeyConstraint(
            ['route_id'],
            ['entity.entity_id'],
        ),
        sa.ForeignKeyConstraint(
            ['route_name_id'],
            ['locale_string.string_id'],
        ), sa.PrimaryKeyConstraint('route_id'))
    op.create_table(
        'user_favorite', sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('entity_id', sa.Integer(), nullable=False),
        sa.Column('add_time',
                  sa.DateTime(),
                  nullable=False,
                  server_default=sa.func.current_timestamp()),
        sa.ForeignKeyConstraint(['entity_id'], ['entity.entity_id'],
                                ondelete='cascade'),
        sa.ForeignKeyConstraint(['user_id'], ['user.user_id'],
                                ondelete='cascade'))
    op.create_index(op.f('ix_user_favorite_entity_id'),
                    'user_favorite', ['entity_id'],
                    unique=False)
    op.create_index(op.f('ix_user_favorite_user_id'),
                    'user_favorite', ['user_id'],
                    unique=False)
    op.create_table(
        'category_object', sa.Column('object_id', sa.Integer(),
                                     nullable=False),
        sa.Column('category_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['category_id'], ['category.category_id'],
                                ondelete='cascade'),
        sa.ForeignKeyConstraint(['object_id'], ['object.object_id'],
                                ondelete='cascade'),
        sa.PrimaryKeyConstraint('object_id', 'category_id'))
    op.create_table(
        'historical_person',
        sa.Column('object_id', sa.Integer(), nullable=False),
        sa.Column('person_name_id', sa.String(length=36), nullable=False),
        sa.Column('person_second_name_id',
                  sa.String(length=36),
                  nullable=False),
        sa.Column('person_patronymic_id', sa.String(length=36), nullable=True),
        sa.Column('person_birthdate', sa.Date(), nullable=False),
        sa.Column('person_deathdate', sa.Date(), nullable=True),
        sa.ForeignKeyConstraint(
            ['object_id'],
            ['object.object_id'],
        ),
        sa.ForeignKeyConstraint(
            ['person_name_id'],
            ['locale_string.string_id'],
        ),
        sa.ForeignKeyConstraint(
            ['person_patronymic_id'],
            ['locale_string.string_id'],
        ),
        sa.ForeignKeyConstraint(
            ['person_second_name_id'],
            ['locale_string.string_id'],
        ), sa.PrimaryKeyConstraint('object_id'))
    op.create_table(
        'place', sa.Column('object_id', sa.Integer(), nullable=False),
        sa.Column('place_name_id', sa.String(length=36), nullable=False),
        sa.Column('place_address_id', sa.String(length=36), nullable=False),
        sa.Column('place_geolocation_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['object_id'],
            ['object.object_id'],
        ),
        sa.ForeignKeyConstraint(
            ['place_address_id'],
            ['locale_string.string_id'],
        ),
        sa.ForeignKeyConstraint(
            ['place_geolocation_id'],
            ['geolocation.geolocation_id'],
        ),
        sa.ForeignKeyConstraint(
            ['place_name_id'],
            ['locale_string.string_id'],
        ), sa.PrimaryKeyConstraint('object_id'))
    op.create_table(
        'historical_person_related_objects',
        sa.Column('historical_person_id', sa.Integer(), nullable=False),
        sa.Column('object_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['historical_person_id'],
                                ['historical_person.object_id'],
                                ondelete='cascade'),
        sa.ForeignKeyConstraint(['object_id'], ['object.object_id'],
                                ondelete='cascade'))
    op.create_table(
        'public_place', sa.Column('object_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['object_id'],
            ['place.object_id'],
        ), sa.PrimaryKeyConstraint('object_id'))
    op.create_table(
        'route_place_info', sa.Column('place_id', sa.Integer(),
                                      nullable=False),
        sa.Column('route_id', sa.Integer(), nullable=False),
        sa.Column('route_place_order', sa.Integer(), nullable=False),
        sa.Column('route_place_description_id',
                  sa.String(length=36),
                  nullable=True),
        sa.Column('route_place_audioguide_link_id',
                  sa.String(length=36),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['place_id'],
            ['place.object_id'],
        ), sa.ForeignKeyConstraint(
            ['route_id'],
            ['route.route_id'],
        ),
        sa.ForeignKeyConstraint(
            ['route_place_audioguide_link_id'],
            ['locale_link.link_id'],
        ),
        sa.ForeignKeyConstraint(
            ['route_place_description_id'],
            ['locale_string.string_id'],
        ), sa.PrimaryKeyConstraint('place_id', 'route_id'))
    op.create_table(
        'timetable', sa.Column('public_place_id', sa.Integer(),
                               nullable=False),
        sa.Column('week_day',
                  sa.Enum('mon',
                          'tue',
                          'wed',
                          'thu',
                          'fri',
                          'sat',
                          'sun',
                          name='weekday'),
                  nullable=False),
        sa.Column('open_time', sa.Time(), nullable=False),
        sa.Column('close_time', sa.Time(), nullable=False),
        sa.ForeignKeyConstraint(
            ['public_place_id'],
            ['public_place.object_id'],
        ), sa.PrimaryKeyConstraint('public_place_id', 'week_day'))
示例#3
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'user', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('type',
                  sa.Enum('PERSONAL', 'BUSINESS', 'ADVERTISEMENT',
                          'ADMINISTRATOR'),
                  nullable=False),
        sa.Column('username', sa.String(length=32), nullable=False),
        sa.Column('password_hash', sa.String(length=128), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('username'))
    op.create_index(op.f('ix_user_type'), 'user', ['type'], unique=False)
    op.create_table('products',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('seller', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=32), nullable=False),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('price', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['seller'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'statuses', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('source_id', sa.Integer(), nullable=False),
        sa.Column('target_id', sa.Integer(), nullable=False),
        sa.Column('level',
                  sa.Enum('PENDING', 'POSITIVE', 'NEUTRAL', 'NEGATIVE'),
                  nullable=False), sa.Column('text', sa.Text(), nullable=True),
        sa.Column('reply', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(
            ['source_id'],
            ['user.id'],
        ), sa.ForeignKeyConstraint(
            ['target_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_statuses_level'),
                    'statuses', ['level'],
                    unique=False)
    op.create_table('user_addresses',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('country', sa.String(length=32), nullable=True),
                    sa.Column('province', sa.String(length=32), nullable=True),
                    sa.Column('city', sa.String(length=32), nullable=True),
                    sa.Column('street', sa.String(length=32), nullable=True),
                    sa.Column('name', sa.String(length=32), nullable=True),
                    sa.Column('phone', sa.String(length=32), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'user_authenticates',
        sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('type',
                  sa.Enum('PERSONAL', 'BUSINESS', 'ADVERTISEMENT'),
                  nullable=False),
        sa.Column('status',
                  sa.Enum('PENDING', 'COMPLETED', 'REJECTED'),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_user_authenticates_status'),
                    'user_authenticates', ['status'],
                    unique=False)
    op.create_index(op.f('ix_user_authenticates_type'),
                    'user_authenticates', ['type'],
                    unique=False)
    op.create_table('user_profile',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('mobile', sa.String(length=11), nullable=False),
                    sa.Column('nickname', sa.String(length=32), nullable=True),
                    sa.Column('avatar', sa.String(length=128), nullable=True),
                    sa.Column('info', sa.Text(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('mobile'))
    op.create_table(
        'orders', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('product_id', sa.Integer(), nullable=False),
        sa.Column('buyer_id', sa.Integer(), nullable=False),
        sa.Column('status',
                  sa.Enum('PENDING', 'PURCHASED', 'DELIVERED', 'COMPLETED',
                          'CANCELLED'),
                  nullable=False),
        sa.Column('comments', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(
            ['buyer_id'],
            ['user.id'],
        ), sa.ForeignKeyConstraint(
            ['product_id'],
            ['products.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_orders_status'),
                    'orders', ['status'],
                    unique=False)
    op.create_table(
        'product_medias', sa.Column('create_time',
                                    sa.DateTime(),
                                    nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('product_id', sa.Integer(), nullable=False),
        sa.Column('filename', sa.String(length=64), nullable=False),
        sa.ForeignKeyConstraint(
            ['product_id'],
            ['products.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'user_authenticate_documents',
        sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('apply_id', sa.Integer(), nullable=False),
        sa.Column('filename', sa.String(length=64), nullable=False),
        sa.ForeignKeyConstraint(
            ['apply_id'],
            ['user_authenticates.id'],
        ), sa.PrimaryKeyConstraint('id'))
示例#4
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('venue_artists')
    op.add_column('Artist', sa.Column('venue_id', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'Artist', 'Venue', ['venue_id'], ['id'])
示例#5
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cab_area_info',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=32), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('cab_facility_info',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=32), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'cab_user_profile',
        sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=32), nullable=False),
        sa.Column('password_hash', sa.String(length=128), nullable=False),
        sa.Column('mobile', sa.String(length=11), nullable=False),
        sa.Column('real_name', sa.String(length=32), nullable=True),
        sa.Column('id_card', sa.String(length=20), nullable=True),
        sa.Column('avatar_url', sa.String(length=128), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('mobile'),
        sa.UniqueConstraint('name'))
    op.create_table(
        'cab_car_info', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('area_id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=64), nullable=False),
        sa.Column('price', sa.Integer(), nullable=True),
        sa.Column('no', sa.String(length=32), nullable=True),
        sa.Column('load', sa.Integer(), nullable=True),
        sa.Column('size', sa.String(length=32), nullable=True),
        sa.Column('type', sa.String(length=32), nullable=True),
        sa.Column('space', sa.Integer(), nullable=True),
        sa.Column('order_count', sa.Integer(), nullable=True),
        sa.Column('index_image_url', sa.String(length=256), nullable=True),
        sa.ForeignKeyConstraint(
            ['area_id'],
            ['cab_area_info.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['cab_user_profile.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'cab_car_facility', sa.Column('car_id', sa.Integer(), nullable=False),
        sa.Column('facility_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['car_id'],
            ['cab_car_info.id'],
        ), sa.ForeignKeyConstraint(
            ['facility_id'],
            ['cab_facility_info.id'],
        ), sa.PrimaryKeyConstraint('car_id', 'facility_id'))
    op.create_table('cab_car_image',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('car_id', sa.Integer(), nullable=False),
                    sa.Column('url', sa.String(length=256), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['car_id'],
                        ['cab_car_info.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'cab_order_info', sa.Column('create_time',
                                    sa.DateTime(),
                                    nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('car_id', sa.Integer(), nullable=False),
        sa.Column('begin_date', sa.DateTime(), nullable=False),
        sa.Column('end_date', sa.DateTime(), nullable=False),
        sa.Column('start_point', sa.String(length=256), nullable=True),
        sa.Column('end_point', sa.String(length=256), nullable=True),
        sa.Column('mileage', sa.Integer(), nullable=False),
        sa.Column('price', sa.Integer(), nullable=False),
        sa.Column('amount', sa.Integer(), nullable=False),
        sa.Column('status',
                  sa.Enum('WAIT_ACCEPT', 'WAIT_PAYMENT', 'PAID',
                          'WAIT_COMMENT', 'COMPLETE', 'CANCELED', 'REJECTED'),
                  nullable=True), sa.Column('comment',
                                            sa.Text(),
                                            nullable=True),
        sa.Column('trade_no', sa.String(length=100), nullable=True),
        sa.ForeignKeyConstraint(
            ['car_id'],
            ['cab_car_info.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['cab_user_profile.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_cab_order_info_status'),
                    'cab_order_info', ['status'],
                    unique=False)
示例#6
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('media', sa.Column('filesize', sa.Integer(), nullable=True))
示例#7
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('bank', sa.Column('branch_counts', sa.Integer(), nullable=True))
    op.drop_column('bank', 'branch_count')
示例#8
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('role_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'users', 'roles', ['role_id'], ['id'])
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('events', sa.Column('site_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'events', 'sites', ['site_id'], ['id'])
    op.add_column('visits', sa.Column('site_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'visits', 'sites', ['site_id'], ['id'])
def upgrade():
    op.add_column('deep_exploration_order', sa.Column('region_id', sa.Integer(), nullable=True))
    op.create_foreign_key(op.f('fk_deep_exploration_order_region_id_region'), 'deep_exploration_order', 'region', ['region_id'], ['id'])
示例#11
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('interventions', sa.Column('subscribed_events', sa.Integer()))
    op.execute('UPDATE interventions SET subscribed_events=0')
    op.alter_column('interventions', 'subscribed_events', nullable=False)
示例#12
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('bin', sa.Column('depth', sa.Integer(), nullable=True))
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('page',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=50), nullable=False),
    sa.Column('parent_page_id', sa.Integer(), nullable=True),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('access_restricted', sa.Boolean(), nullable=False),
    sa.Column('url_identifier', sa.String(length=50), nullable=False),
    sa.ForeignKeyConstraint(['parent_page_id'], ['content.page.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('parent_page_id', 'url_identifier'),
    schema='content'
    )
    op.create_table('group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('type', sa.String(length=50), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_table('permission',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_table('registration',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('firstName', sa.String(length=60), nullable=True),
    sa.Column('lastName', sa.String(length=60), nullable=True),
    sa.Column('email', sa.String(length=100), nullable=True),
    sa.Column('username', sa.String(length=20), nullable=True),
    sa.Column('password', sa.String(length=60), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('username'),
    schema='general'
    )
    op.create_table('revue_year',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=50), nullable=False),
    sa.Column('year', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('firstName', sa.String(length=60), nullable=True),
    sa.Column('lastName', sa.String(length=60), nullable=True),
    sa.Column('email', sa.String(length=100), nullable=True),
    sa.Column('username', sa.String(length=20), nullable=True),
    sa.Column('password', sa.String(length=60), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('username'),
    schema='general'
    )
    op.create_table('content_element',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('type', sa.Enum('text', 'container', 'vuedle', 'announcement', name='content_element_types'), nullable=False),
    sa.Column('sticky', sa.Boolean(), nullable=False),
    sa.Column('title', sa.String(length=50), nullable=False),
    sa.Column('identifier', sa.String(length=50), nullable=False),
    sa.Column('author_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['author_id'], ['general.user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='content'
    )
    op.create_table('menu_entry',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=50), nullable=False),
    sa.Column('page_id', sa.Integer(), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.ForeignKeyConstraint(['page_id'], ['content.page.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='content'
    )
    op.create_table('persistent_group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('parent_persistent_group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['id'], ['general.group.id'], ),
    sa.ForeignKeyConstraint(['parent_persistent_group_id'], ['general.persistent_group.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_table('persistent_group_participation',
    sa.Column('persistent_group_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['persistent_group_id'], ['general.group.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['general.user.id'], ),
    sa.PrimaryKeyConstraint('persistent_group_id', 'user_id'),
    schema='general'
    )
    op.create_table('user_permission',
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('permission_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['permission_id'], ['general.permission.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['general.user.id'], ),
    sa.PrimaryKeyConstraint('user_id', 'permission_id'),
    schema='general'
    )
    op.create_table('year_group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('parent_year_group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['id'], ['general.group.id'], ),
    sa.ForeignKeyConstraint(['parent_year_group_id'], ['general.year_group.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_table('group_menu',
    sa.Column('menu_entry', sa.Integer(), nullable=False),
    sa.Column('group_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['group_id'], ['general.group.id'], ),
    sa.ForeignKeyConstraint(['menu_entry'], ['content.menu_entry.id'], ),
    sa.PrimaryKeyConstraint('group_id'),
    schema='content'
    )
    op.create_table('menu_entry_relationship',
    sa.Column('child_id', sa.Integer(), nullable=False),
    sa.Column('parent_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['child_id'], ['content.menu_entry.id'], ),
    sa.ForeignKeyConstraint(['parent_id'], ['content.menu_entry.id'], ),
    sa.PrimaryKeyConstraint('parent_id', 'child_id'),
    schema='content'
    )
    op.create_table('page_access_restriction',
    sa.Column('page_id', sa.Integer(), nullable=False),
    sa.Column('year_group_id', sa.Integer(), nullable=False),
    sa.Column('revue_year_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['page_id'], ['content.page.id'], ),
    sa.ForeignKeyConstraint(['revue_year_id'], ['general.revue_year.id'], ),
    sa.ForeignKeyConstraint(['year_group_id'], ['general.year_group.id'], ),
    sa.PrimaryKeyConstraint('page_id', 'year_group_id', 'revue_year_id'),
    schema='content'
    )
    op.create_table('page_content_element',
    sa.Column('content_element_id', sa.Integer(), nullable=False),
    sa.Column('page_id', sa.Integer(), nullable=False),
    sa.Column('order_index', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['content_element_id'], ['content.content_element.id'], ),
    sa.ForeignKeyConstraint(['page_id'], ['content.page.id'], ),
    sa.PrimaryKeyConstraint('content_element_id', 'page_id'),
    schema='content'
    )
    op.create_table('text_element',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.Text(), nullable=False),
    sa.ForeignKeyConstraint(['id'], ['content.content_element.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='content'
    )
    op.create_table('year_group_participation',
    sa.Column('year_id', sa.Integer(), nullable=False),
    sa.Column('year_group_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['general.user.id'], ),
    sa.ForeignKeyConstraint(['year_group_id'], ['general.year_group.id'], ),
    sa.ForeignKeyConstraint(['year_id'], ['general.revue_year.id'], ),
    sa.PrimaryKeyConstraint('year_id', 'year_group_id', 'user_id'),
    schema='general'
    )
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('info_category',
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.Column('update_time', sa.DateTime(), nullable=True),
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'info_user', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('nick_name', sa.String(length=32), nullable=False),
        sa.Column('password_hash', sa.String(length=128), nullable=False),
        sa.Column('mobile', sa.String(length=11), nullable=False),
        sa.Column('avatar_url', sa.String(length=256), nullable=True),
        sa.Column('last_login', sa.DateTime(), nullable=True),
        sa.Column('is_admin', sa.Boolean(), nullable=True),
        sa.Column('signature', sa.String(length=512), nullable=True),
        sa.Column('gender', sa.Enum('MAN', 'WOMAN'), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('mobile'),
        sa.UniqueConstraint('nick_name'))
    op.create_table(
        'info_news', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('title', sa.String(length=256), nullable=False),
        sa.Column('source', sa.String(length=64), nullable=False),
        sa.Column('digest', sa.String(length=512), nullable=False),
        sa.Column('content', sa.Text(), nullable=False),
        sa.Column('clicks', sa.Integer(), nullable=True),
        sa.Column('index_image_url', sa.String(length=256), nullable=True),
        sa.Column('category_id', sa.Integer(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('status', sa.Integer(), nullable=True),
        sa.Column('reason', sa.String(length=256), nullable=True),
        sa.ForeignKeyConstraint(
            ['category_id'],
            ['info_category.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['info_user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'info_user_fans', sa.Column('follower_id',
                                    sa.Integer(),
                                    nullable=False),
        sa.Column('followed_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['followed_id'],
            ['info_user.id'],
        ), sa.ForeignKeyConstraint(
            ['follower_id'],
            ['info_user.id'],
        ), sa.PrimaryKeyConstraint('follower_id', 'followed_id'))
    op.create_table(
        'info_comment', sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('news_id', sa.Integer(), nullable=False),
        sa.Column('content', sa.Text(), nullable=False),
        sa.Column('parent_id', sa.Integer(), nullable=True),
        sa.Column('like_count', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['news_id'],
            ['info_news.id'],
        ), sa.ForeignKeyConstraint(
            ['parent_id'],
            ['info_comment.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['info_user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table('info_user_collection',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('news_id', sa.Integer(), nullable=False),
                    sa.Column('create_time', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['news_id'],
                        ['info_news.id'],
                    ), sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['info_user.id'],
                    ), sa.PrimaryKeyConstraint('user_id', 'news_id'))
    op.create_table(
        'info_comment_like',
        sa.Column('create_time', sa.DateTime(), nullable=True),
        sa.Column('update_time', sa.DateTime(), nullable=True),
        sa.Column('comment_id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['comment_id'],
            ['info_comment.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['info_user.id'],
        ), sa.PrimaryKeyConstraint('comment_id', 'user_id'))
示例#15
0
文件: db.py 项目: celskeggs/qazoo-qm
class Location(SQLBase):
    __tablename__ = "location"
    uid = sqlalchemy.Column(sqlalchemy.Integer(),
                            nullable=False,
                            primary_key=True)
    name = sqlalchemy.Column(sqlalchemy.String(127), nullable=False)
示例#16
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('members', sa.Column('group_id', sa.Integer(), nullable=True))
    op.add_column('members', sa.Column('pcf_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'members', 'pcfs', ['pcf_id'], ['id'])
    op.create_foreign_key(None, 'members', 'groups', ['group_id'], ['id'])
示例#17
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user_currencies',
                  sa.Column('amount', sa.Integer(), nullable=True))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'user', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=64), nullable=True),
        sa.Column('email', sa.String(length=120), nullable=True),
        sa.Column('password_hash', sa.String(length=128), nullable=True),
        sa.Column('moola', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_username'),
                    'user', ['username'],
                    unique=True)
    op.create_table(
        'game', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('userId', sa.Integer(), nullable=True),
        sa.Column('sport', sa.String(length=30), nullable=True),
        sa.Column('location', sa.String(length=120), nullable=True),
        sa.Column('watchSpot', sa.String(length=60), nullable=True),
        sa.Column('eventName', sa.String(length=90), nullable=True),
        sa.Column('openingBetA', sa.Integer(), nullable=True),
        sa.Column('openingBetB', sa.Integer(), nullable=True),
        sa.Column('currentBetA', sa.Integer(), nullable=True),
        sa.Column('currentBetB', sa.Integer(), nullable=True),
        sa.Column('teamA', sa.String(length=30), nullable=True),
        sa.Column('teamB', sa.String(length=30), nullable=True),
        sa.ForeignKeyConstraint(
            ['userId'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'bet', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('userId', sa.Integer(), nullable=True),
        sa.Column('amountBetting', sa.Integer(), nullable=True),
        sa.Column('teamBetting', sa.String(length=30), nullable=True),
        sa.Column('gameId', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['gameId'],
            ['game.id'],
        ), sa.ForeignKeyConstraint(
            ['userId'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
示例#19
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('sub_quest', sa.Column('group', sa.Integer(), nullable=True))
    op.add_column('sub_quest',
                  sa.Column('operator_id', sa.Integer(), nullable=True))
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('radio_person', sa.Column('network_id', sa.Integer(), nullable=True))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('list_stats', schema=None) as batch_op:
        batch_op.add_column(sa.Column('subscribers', sa.Integer(), nullable=True))
def upgrade():
    op.add_column('task_group_tasks', sa.Column('contact_id', sa.Integer(), nullable=True))
    op.add_column('task_group_tasks', sa.Column('description', sa.Text(), nullable=True))
    #op.add_column('task_group_tasks', sa.Column('slug', sa.String(length=250), nullable=False))
    op.add_column('task_group_tasks', sa.Column('title', sa.String(length=250), nullable=False))
示例#23
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=64), nullable=True),
                    sa.Column('default', sa.Boolean(), nullable=True),
                    sa.Column('permissions', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_index(op.f('ix_roles_default'),
                    'roles', ['default'],
                    unique=False)
    op.create_table(
        'users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('email', sa.String(length=64), nullable=True),
        sa.Column('username', sa.String(length=64), nullable=True),
        sa.Column('role_id', sa.Integer(), nullable=True),
        sa.Column('password_hash', sa.String(length=128), nullable=True),
        sa.Column('confirmed', sa.Boolean(), nullable=True),
        sa.Column('name', sa.String(length=64), nullable=True),
        sa.Column('location', sa.String(length=64), nullable=True),
        sa.Column('about_me', sa.Text(), nullable=True),
        sa.Column('member_since', sa.DateTime(), nullable=True),
        sa.Column('last_seen', sa.DateTime(), nullable=True),
        sa.Column('avatar_hash', sa.String(length=32), nullable=True),
        sa.ForeignKeyConstraint(
            ['role_id'],
            ['roles.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'),
                    'users', ['username'],
                    unique=True)
    op.create_table('follows',
                    sa.Column('follower_id', sa.Integer(), nullable=False),
                    sa.Column('followed_id', sa.Integer(), nullable=False),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['followed_id'],
                        ['users.id'],
                    ), sa.ForeignKeyConstraint(
                        ['follower_id'],
                        ['users.id'],
                    ), sa.PrimaryKeyConstraint('follower_id', 'followed_id'))
    op.create_table('posts', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('body', sa.Text(), nullable=True),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.Column('author_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['author_id'],
                        ['users.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_posts_timestamp'),
                    'posts', ['timestamp'],
                    unique=False)
    op.create_table('comments', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('body', sa.Text(), nullable=True),
                    sa.Column('body_html', sa.Text(), nullable=True),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.Column('disabled', sa.Boolean(), nullable=True),
                    sa.Column('author_id', sa.Integer(), nullable=True),
                    sa.Column('post_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['author_id'],
                        ['users.id'],
                    ), sa.ForeignKeyConstraint(
                        ['post_id'],
                        ['posts.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_comments_timestamp'),
                    'comments', ['timestamp'],
                    unique=False)
示例#24
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False, comment='用户名,用作登录'),
    sa.Column('real_name', sa.String(length=64), nullable=True, comment='姓名'),
    sa.Column('avatar', sa.String(length=255), nullable=False),
    sa.Column('email', sa.String(length=255), nullable=False),
    sa.Column('password', sa.String(length=255), nullable=False),
    sa.Column('phone', sa.String(length=20), nullable=True),
    sa.Column('role', sa.SmallInteger(), nullable=True),
    sa.Column('work_years', sa.SmallInteger(), nullable=True, comment='工作年龄'),
    sa.Column('resume_url', sa.String(length=64), nullable=True),
    sa.Column('is_disable', sa.Boolean(), nullable=True, comment='是否被封禁'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('phone')
    )
    op.create_index(op.f('ix_user_name'), 'user', ['name'], unique=True)
    op.create_table('company',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False, comment='公司名'),
    sa.Column('short_name', sa.String(length=64), nullable=True, comment='公司简称'),
    sa.Column('short_description', sa.String(length=64), nullable=True, comment='一句话描述'),
    sa.Column('logo', sa.String(length=64), nullable=False),
    sa.Column('website', sa.String(length=64), nullable=True),
    sa.Column('contact', sa.String(length=24), nullable=True, comment='联系方式'),
    sa.Column('location', sa.String(length=24), nullable=True, comment='公司地址'),
    sa.Column('full_description', sa.String(length=255), nullable=True, comment='关于我们,公司详情描述'),
    sa.Column('tags', sa.String(length=128), nullable=True, comment='公司标签,用多个逗号隔开'),
    sa.Column('stack', sa.String(length=128), nullable=True, comment='公司技术栈,用多个逗号隔开'),
    sa.Column('team_des', sa.String(length=255), nullable=True, comment='团队介绍'),
    sa.Column('welfare', sa.String(length=255), nullable=True, comment='公司福利,用多个逗号隔开'),
    sa.Column('trade', sa.String(length=32), nullable=True, comment='所处行业'),
    sa.Column('funding', sa.String(length=32), nullable=True, comment='融资阶段'),
    sa.Column('city', sa.String(length=32), nullable=True, comment='所在城市'),
    sa.Column('size', sa.String(length=32), nullable=True, comment='企业规模'),
    sa.Column('lagou_company_id', sa.Integer(), nullable=True, comment='拉钩公司id,方便日后爬取数据用'),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_company_name'), 'company', ['name'], unique=True)
    op.create_table('job',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True, comment='职位名称'),
    sa.Column('salary_max', sa.Integer(), nullable=True),
    sa.Column('salary_min', sa.Integer(), nullable=True),
    sa.Column('location', sa.String(length=32), nullable=True, comment='工作地点'),
    sa.Column('tags', sa.String(length=128), nullable=True, comment='职位标签'),
    sa.Column('experience_requirement', sa.String(length=32), nullable=True, comment='工作经验要求'),
    sa.Column('degree_requirement', sa.String(length=32), nullable=True, comment='学历要求'),
    sa.Column('job_nature', sa.String(length=32), nullable=True, comment='是否全职'),
    sa.Column('is_open', sa.Boolean(), nullable=True, comment='是否在招聘'),
    sa.Column('company_id', sa.Integer(), nullable=True),
    sa.Column('view_count', sa.Integer(), nullable=True, comment='该岗位浏览数'),
    sa.Column('description', sa.String(length=1024), nullable=True),
    sa.ForeignKeyConstraint(['company_id'], ['user.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('delivery',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('job_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('status', sa.SmallInteger(), nullable=True, comment='投递状态'),
    sa.Column('location', sa.String(length=255), nullable=True, comment='企业回应'),
    sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='SET NULL'),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user_job',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('job_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['job_id'], ['job.id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE')
    )
示例#25
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'cluster',
        sa.Column('status', sa.Integer(), nullable=True, comment='1:启用,0:禁用'))
def downgrade():
    bind = op.get_bind()
    insp = sa.engine.reflection.Inspector.from_engine(bind)

    op.create_table(
        "sql_observers",
        sa.Column("created_on", sa.DateTime(), nullable=True),
        sa.Column("changed_on", sa.DateTime(), nullable=True),
        sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
        sa.Column("sql", sa.Text(), nullable=False),
        sa.Column("created_by_fk", sa.Integer(), autoincrement=False, nullable=True),
        sa.Column("changed_by_fk", sa.Integer(), autoincrement=False, nullable=True),
        sa.Column("alert_id", sa.Integer(), autoincrement=False, nullable=False),
        sa.Column("database_id", sa.Integer(), autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(["alert_id"], ["alerts.id"]),
        sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
        sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
        sa.ForeignKeyConstraint(["database_id"], ["dbs.id"]),
        sa.PrimaryKeyConstraint("id"),
    )

    op.create_table(
        "alert_validators",
        sa.Column("created_on", sa.DateTime(), nullable=True),
        sa.Column("changed_on", sa.DateTime(), nullable=True),
        sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
        sa.Column("validator_type", sa.String(length=100), nullable=False,),
        sa.Column("config", sa.Text(), nullable=True),
        sa.Column("created_by_fk", sa.Integer(), autoincrement=False, nullable=True),
        sa.Column("changed_by_fk", sa.Integer(), autoincrement=False, nullable=True),
        sa.Column("alert_id", sa.Integer(), autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(
            ["alert_id"], ["alerts.id"], name="alert_validators_ibfk_1"
        ),
        sa.ForeignKeyConstraint(
            ["changed_by_fk"], ["ab_user.id"], name="alert_validators_ibfk_2"
        ),
        sa.ForeignKeyConstraint(
            ["created_by_fk"], ["ab_user.id"], name="alert_validators_ibfk_3"
        ),
        sa.PrimaryKeyConstraint("id"),
    )

    # Migrate data
    session = db.Session(bind=bind)
    alerts = session.query(Alert).all()
    for a in alerts:
        if a.sql:
            ob = SQLObserver(sql=a.sql, database_id=a.database_id)
            a.sql_observer.append(ob)
            session.add(ob)
        if a.validator_type:
            val = Validator(
                validator_type=a.validator_type,
                config=a.validator_config,
                alert_id=a.id,
            )
            a.validators.append(val)
            session.add(val)
    session.commit()

    # sqlite does not support dropping columns
    if isinstance(bind.dialect, SQLiteDialect):
        op.add_column(
            "sql_observations",
            sa.Column(
                "observer_id",
                sa.Integer(),
                autoincrement=False,
                nullable=False,
                server_default="0",
            ),
        )
        op.drop_table("alerts")
        op.create_table(
            "alerts",
            sa.Column("id", sa.Integer(), nullable=False),
            sa.Column("label", sa.String(length=150), nullable=False),
            sa.Column("active", sa.Boolean(), nullable=True),
            sa.Column("crontab", sa.String(length=50), nullable=False),
            sa.Column("alert_type", sa.String(length=50), nullable=True),
            sa.Column("log_retention", sa.Integer(), nullable=False, default=90),
            sa.Column(
                "grace_period", sa.Integer(), nullable=False, default=60 * 60 * 24
            ),
            sa.Column("recipients", sa.Text(), nullable=True),
            sa.Column("slice_id", sa.Integer(), nullable=True),
            sa.Column("dashboard_id", sa.Integer(), nullable=True),
            sa.Column("last_eval_dttm", sa.DateTime(), nullable=True),
            sa.Column("last_state", sa.String(length=10), nullable=True),
            sa.Column("changed_by_fk", sa.Integer(), nullable=True),
            sa.Column("changed_on", sa.DateTime(), nullable=True),
            sa.Column("created_by_fk", sa.Integer(), nullable=True),
            sa.Column("created_on", sa.DateTime(), nullable=True),
            sa.Column("slack_channel", sa.Text(), nullable=True),
            sa.ForeignKeyConstraint(["dashboard_id"], ["dashboards.id"],),
            sa.ForeignKeyConstraint(["slice_id"], ["slices.id"],),
            sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"],),
            sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"],),
            sa.PrimaryKeyConstraint("id"),
        )
    else:
        op.add_column(
            "sql_observations",
            sa.Column(
                "observer_id",
                sa.Integer(),
                autoincrement=False,
                nullable=False,
                default=0,
            ),
        )
        constraint = generic_find_fk_constraint_name("alerts", {"id"}, "dbs", insp)
        op.drop_constraint(constraint, "alerts", type_="foreignkey")
        op.drop_column("alerts", "validator_type")
        op.drop_column("alerts", "sql")
        op.drop_column("alerts", "database_id")
        op.drop_column("alerts", "validator_config")

        op.create_foreign_key(
            "sql_observations_ibfk_2",
            "sql_observations",
            "sql_observers",
            ["observer_id"],
            ["id"],
        )
示例#27
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('campaign',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_time', sa.DateTime(), nullable=True),
    sa.Column('modified_time', sa.DateTime(), nullable=True),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('indicator_confidence',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('value')
    )
    op.create_table('indicator_impact',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('value')
    )
    op.create_table('indicator_status',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('value')
    )
    op.create_table('indicator_type',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('value')
    )
    op.create_table('intel_source',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('value')
    )
    op.create_table('role',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=True),
    sa.Column('description', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('tag',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('active', sa.Boolean(), nullable=False),
    sa.Column('apikey', sa.String(length=36), nullable=False),
    sa.Column('email', sa.String(length=255), nullable=False),
    sa.Column('first_name', sa.String(length=50), nullable=False),
    sa.Column('last_name', sa.String(length=50), nullable=False),
    sa.Column('password', sa.String(length=130), nullable=False),
    sa.Column('username', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('username')
    )
    op.create_index(op.f('ix_user_apikey'), 'user', ['apikey'], unique=True)
    op.create_table('campaign_alias',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('alias', sa.String(length=255), nullable=False),
    sa.Column('campaign_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['campaign_id'], ['campaign.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('alias')
    )
    op.create_table('indicator',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('case_sensitive', sa.Boolean(), nullable=False),
    sa.Column('confidence_id', sa.Integer(), nullable=False),
    sa.Column('created_time', sa.DateTime(), nullable=True),
    sa.Column('impact_id', sa.Integer(), nullable=False),
    sa.Column('modified_time', sa.DateTime(), nullable=True),
    sa.Column('status_id', sa.Integer(), nullable=False),
    sa.Column('substring', sa.Boolean(), nullable=False),
    sa.Column('type_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('value', sa.UnicodeText(), nullable=False),
    sa.ForeignKeyConstraint(['confidence_id'], ['indicator_confidence.id'], ),
    sa.ForeignKeyConstraint(['impact_id'], ['indicator_impact.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['indicator_status.id'], ),
    sa.ForeignKeyConstraint(['type_id'], ['indicator_type.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('intel_reference',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('reference', sa.String(length=512), nullable=False),
    sa.Column('intel_source_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['intel_source_id'], ['intel_source.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('intel_source_id', 'reference')
    )
    op.create_index(op.f('ix_intel_reference_reference'), 'intel_reference', ['reference'], unique=False)
    op.create_table('role_user_mapping',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    op.create_table('indicator_campaign_mapping',
    sa.Column('indicator_id', sa.Integer(), nullable=True),
    sa.Column('campaign_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['campaign_id'], ['campaign.id'], ),
    sa.ForeignKeyConstraint(['indicator_id'], ['indicator.id'], )
    )
    op.create_table('indicator_equal_mapping',
    sa.Column('left_id', sa.Integer(), nullable=False),
    sa.Column('right_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['left_id'], ['indicator.id'], ),
    sa.ForeignKeyConstraint(['right_id'], ['indicator.id'], ),
    sa.PrimaryKeyConstraint('left_id', 'right_id')
    )
    op.create_table('indicator_reference_mapping',
    sa.Column('indicator_id', sa.Integer(), nullable=True),
    sa.Column('intel_reference_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['indicator_id'], ['indicator.id'], ),
    sa.ForeignKeyConstraint(['intel_reference_id'], ['intel_reference.id'], )
    )
    op.create_table('indicator_relationship_mapping',
    sa.Column('parent_id', sa.Integer(), nullable=False),
    sa.Column('child_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['child_id'], ['indicator.id'], ),
    sa.ForeignKeyConstraint(['parent_id'], ['indicator.id'], ),
    sa.PrimaryKeyConstraint('parent_id', 'child_id')
    )
    op.create_table('indicator_tag_mapping',
    sa.Column('indicator_id', sa.Integer(), nullable=True),
    sa.Column('tag_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['indicator_id'], ['indicator.id'], ),
    sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], )
    )
def upgrade():
    bind = op.get_bind()
    insp = sa.engine.reflection.Inspector.from_engine(bind)

    if isinstance(bind.dialect, SQLiteDialect):
        op.add_column(
            "alerts",
            sa.Column("validator_config", sa.Text(), server_default="", nullable=True),
        )
        op.add_column(
            "alerts",
            sa.Column("database_id", sa.Integer(), server_default="0", nullable=False),
        )
        op.add_column(
            "alerts", sa.Column("sql", sa.Text(), server_default="", nullable=False)
        )
        op.add_column(
            "alerts",
            sa.Column(
                "validator_type",
                sa.String(length=100),
                server_default="",
                nullable=False,
            ),
        )
    else:  # mysql does not support server_default for text fields
        op.add_column(
            "alerts",
            sa.Column("validator_config", sa.Text(), default="", nullable=True),
        )
        op.add_column(
            "alerts", sa.Column("database_id", sa.Integer(), default=0, nullable=False),
        )
        op.add_column("alerts", sa.Column("sql", sa.Text(), default="", nullable=False))
        op.add_column(
            "alerts",
            sa.Column(
                "validator_type", sa.String(length=100), default="", nullable=False
            ),
        )
    # Migrate data
    session = db.Session(bind=bind)
    alerts = session.query(Alert).all()
    for a in alerts:
        if a.sql_observer:
            a.sql = a.sql_observer[0].sql
            a.database_id = a.sql_observer[0].database_id
        if a.validators:
            a.validator_type = a.validators[0].validator_type
            a.validator_config = a.validators[0].config
    session.commit()

    if not isinstance(bind.dialect, SQLiteDialect):
        constraint = generic_find_fk_constraint_name(
            "sql_observations", {"id"}, "sql_observers", insp
        )
        op.drop_constraint(constraint, "sql_observations", type_="foreignkey")
        op.drop_column("sql_observations", "observer_id")

    op.drop_table("alert_validators")
    op.drop_table("sql_observers")

    # sqlite does not support column and fk deletion
    if isinstance(bind.dialect, SQLiteDialect):
        op.drop_table("sql_observations")
        op.create_table(
            "sql_observations",
            sa.Column("id", sa.Integer(), nullable=False),
            sa.Column("dttm", sa.DateTime(), nullable=True),
            sa.Column("alert_id", sa.Integer(), nullable=True),
            sa.Column("value", sa.Float(), nullable=True),
            sa.Column("error_msg", sa.String(length=500), nullable=True),
            sa.ForeignKeyConstraint(["alert_id"], ["alerts.id"],),
            sa.PrimaryKeyConstraint("id"),
        )
    else:
        op.create_foreign_key(None, "alerts", "dbs", ["database_id"], ["id"])
示例#29
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('category',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('category_name', sa.String(length=20), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('order',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('status', sa.Enum('pending', 'unshipped', 'shipped', 'completed', 'canceled', name='orderstatus'), nullable=True),
    sa.Column('processed_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('tag',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('tag_name', sa.String(length=20), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=True),
    sa.Column('salt', sa.String(length=200), nullable=True),
    sa.Column('password', sa.String(length=200), nullable=True),
    sa.Column('email', sa.String(length=200), nullable=True),
    sa.Column('avatar', sa.String(length=256), nullable=True),
    sa.Column('last_login', sa.DateTime(), nullable=True),
    sa.Column('status', sa.Enum('active', 'inactive', 'suspended', name='accountstatus'), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('address',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('street', sa.String(length=200), nullable=True),
    sa.Column('city', sa.String(length=128), nullable=True),
    sa.Column('state', sa.String(length=200), nullable=True),
    sa.Column('zip_code', sa.String(length=10), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('cart',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('product',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('product_name', sa.String(length=200), nullable=True),
    sa.Column('description', sa.String(length=200), nullable=True),
    sa.Column('price', sa.DECIMAL(), nullable=True),
    sa.Column('produced_at', sa.DateTime(), nullable=True),
    sa.Column('capacity', sa.Integer(), nullable=True),
    sa.Column('category', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['category'], ['category.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('shipment',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.Column('shipment_status', sa.Enum('pending', 'shipped', 'delivered', 'on_hold', 'received', name='shipmentstatus'), nullable=True),
    sa.ForeignKeyConstraint(['order_id'], ['order.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('item',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.Column('cart_id', sa.Integer(), nullable=True),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.Column('amount', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['cart_id'], ['cart.id'], ),
    sa.ForeignKeyConstraint(['order_id'], ['order.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('productreview',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('rating', sa.Integer(), nullable=True),
    sa.Column('review', sa.Text(), nullable=True),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('shipmenttrack',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('shipment_date', sa.Enum('pending', 'shipped', 'delivered', 'on_hold', 'received', name='shipmentstatus'), nullable=True),
    sa.Column('estimated_arrival', sa.DateTime(), nullable=True),
    sa.Column('track_number', sa.String(length=200), nullable=True),
    sa.Column('shipment_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['shipment_id'], ['shipment.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
示例#30
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('User',
                  sa.Column('account_provider', sa.Integer(), nullable=True))