Exemplo n.º 1
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('Livro', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('autor', sa.String(length=50), nullable=False),
                    sa.Column('titulo', sa.String(length=50), nullable=False),
                    sa.Column('ano', sa.Integer(), nullable=False),
                    sa.Column('editora', sa.String(length=50), nullable=False),
                    sa.Column('codigo', sa.String(length=50), nullable=False),
                    sa.Column('quantidade', sa.Integer(), nullable=False),
                    sa.Column('disponivel', sa.Integer(), nullable=False),
                    sa.Column('ativo', sa.Boolean(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('codigo'))
    op.create_table('Usuario', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('nome', sa.String(length=50), nullable=False),
                    sa.Column('login', sa.String(length=50), nullable=False),
                    sa.Column('senha', sa.String(length=100), nullable=False),
                    sa.Column('email', sa.String(length=50), nullable=False),
                    sa.Column('ativo', sa.Boolean(), nullable=True),
                    sa.Column('tipo', sa.String(length=50), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('email'), sa.UniqueConstraint('login'))
    op.create_table(
        'Cliente', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('cpf', sa.String(length=50), nullable=False),
        sa.Column('telefone', sa.String(length=50), nullable=False),
        sa.ForeignKeyConstraint(
            ['id'],
            ['Usuario.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('cpf'))
    op.create_table('Funcionario', sa.Column('id',
                                             sa.Integer(),
                                             nullable=False),
                    sa.Column('cargo', sa.String(length=50), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['id'],
                        ['Usuario.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'Aluga', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('data_locacao', sa.Date(), nullable=False),
        sa.Column('data_devolucao', sa.Date(), nullable=False),
        sa.Column('data_devolvido', sa.Date(), nullable=True),
        sa.Column('diaria', sa.Float(), nullable=False),
        sa.Column('ativo', sa.Boolean(), nullable=True),
        sa.Column('id_funcionario', sa.Integer(), nullable=False),
        sa.Column('id_cliente', sa.Integer(), nullable=False),
        sa.Column('id_livro', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['id_cliente'],
            ['Cliente.id'],
        ), sa.ForeignKeyConstraint(
            ['id_funcionario'],
            ['Funcionario.id'],
        ), sa.ForeignKeyConstraint(
            ['id_livro'],
            ['Livro.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table('Reserva', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('data_reserva', sa.Date(), nullable=False),
                    sa.Column('data_retirada', sa.Date(), nullable=False),
                    sa.Column('ativo', sa.Boolean(), nullable=True),
                    sa.Column('id_cliente', sa.Integer(), nullable=False),
                    sa.Column('id_livro', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['id_cliente'],
                        ['Cliente.id'],
                    ), sa.ForeignKeyConstraint(
                        ['id_livro'],
                        ['Livro.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table('Conta', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('data_efetuada', sa.Date(), nullable=False),
                    sa.Column('data_pagamento', sa.Date(), nullable=False),
                    sa.Column('data_paga', sa.Date(), nullable=True),
                    sa.Column('multa', sa.Float(), nullable=True),
                    sa.Column('valor_total', sa.Float(), nullable=True),
                    sa.Column('ativo', sa.Boolean(), nullable=True),
                    sa.Column('id_aluga', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['id_aluga'],
                        ['Aluga.id'],
                    ), sa.PrimaryKeyConstraint('id'))
Exemplo n.º 2
0
def upgrade():
    # commands auto generated by Alembic - please adjust! #
    op.create_table(
        'live_configuration',
        sa.Column('modification_time', sa.DateTime(), nullable=False),
        sa.Column('modification_user', sa.String(length=32), nullable=True),
        sa.Column('application_url', sa.String(length=36), nullable=True),
        sa.Column('tow_radius', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('modification_time'))
    op.create_table(
        'location', sa.Column('id', sa.String(length=64), nullable=False),
        sa.Column('lat', sa.Float(), nullable=True),
        sa.Column('lon', sa.Float(), nullable=True),
        sa.Column('is_water', sa.Boolean(), nullable=True),
        sa.Column('color_google', sa.String(length=36), nullable=True),
        sa.Column('last_seen', sa.Date(), nullable=True),
        sa.Column('geom',
                  geoalchemy2.types.Geometry(geometry_type='POLYGON'),
                  nullable=True), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'location_history', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('location_id', sa.String(length=64), nullable=True),
        sa.Column('user_id', sa.String(length=32), nullable=True),
        sa.Column('timestamp', sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'tow_event', sa.Column('id', sa.String(length=32), nullable=False),
        sa.Column('accepted_time', sa.DateTime(), nullable=True),
        sa.Column('completed_time', sa.DateTime(), nullable=True),
        sa.Column('cancelled_time', sa.DateTime(), nullable=True),
        sa.Column('time_sent', sa.DateTime(), nullable=True),
        sa.Column('requestor_id', sa.String(length=32), nullable=True),
        sa.Column('requestee_id', sa.String(length=32), nullable=True),
        sa.Column('status', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'tow_request_batch',
        sa.Column('id', sa.String(length=32), nullable=False),
        sa.Column('requestor_id', sa.String(length=32), nullable=True),
        sa.Column('time_sent', sa.DateTime(), nullable=True),
        sa.Column('num_requests', sa.Integer(), nullable=True),
        sa.Column('num_rejections', sa.Integer(), nullable=True),
        sa.Column('last_update', sa.DateTime(), nullable=True),
        sa.Column('status', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'terraintracker_user',
        sa.Column('id', sa.String(length=32), nullable=False),
        sa.Column('phone', sa.String(length=10), nullable=True),
        sa.Column('email', sa.String(length=255), nullable=True),
        sa.Column('first_name', sa.String(length=40), nullable=True),
        sa.Column('last_name', sa.String(length=40), nullable=True),
        sa.Column('active', sa.Boolean(), nullable=True),
        sa.Column('last_geo_point_seen',
                  geoalchemy2.types.Geography(geometry_type='POINT',
                                              srid=4326),
                  nullable=True),
        sa.Column('last_lat_seen', sa.String(length=255), nullable=True),
        sa.Column('last_long_seen', sa.String(length=255), nullable=True),
        sa.Column('last_time_seen', sa.DateTime(), nullable=True),
        sa.Column('over_water', sa.Boolean(), nullable=True),
        sa.Column('requestee_tow_request_id',
                  sa.String(length=255),
                  nullable=True),
        sa.Column('active_tow_event_serving_id',
                  sa.String(length=32),
                  nullable=True),
        sa.Column('active_tow_event_receiving_id',
                  sa.String(length=32),
                  nullable=True),
        sa.Column('stored_token', sa.String(length=256), nullable=True),
        sa.Column('apns_token', sa.String(length=255), nullable=True),
        sa.Column('honorific', sa.String(length=10), nullable=True),
        sa.Column('gender', sa.String(length=1), nullable=True),
        sa.Column('address1', sa.String(length=255), nullable=True),
        sa.Column('address2', sa.String(length=255), nullable=True),
        sa.Column('city', sa.String(length=40), nullable=True),
        sa.Column('state', sa.String(length=2), nullable=True),
        sa.Column('zipcode', sa.String(length=10), nullable=True),
        sa.Column('country', sa.String(length=40), nullable=True),
        sa.Column('nationality', sa.String(length=255), nullable=True),
        sa.Column('notes', sa.String(length=255), nullable=True),
        sa.Column('middle_name', sa.String(length=40), nullable=True),
        sa.Column('birth_date', sa.String(length=10), nullable=True),
        sa.Column('uses_parent_account', sa.Boolean(), nullable=True),
        sa.Column('parent_id', sa.String(length=32), nullable=True),
        sa.Column('id_card_number', sa.String(length=255), nullable=True),
        sa.Column('id_card_expiration_date',
                  sa.String(length=10),
                  nullable=True),
        sa.Column('_password', sa.String(length=255), nullable=True),
        sa.Column('company', sa.String(length=255), nullable=True),
        sa.Column('ip_address', sa.String(length=45), nullable=True),
        sa.Column('_is_test_user', sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(
            ['active_tow_event_receiving_id'],
            ['tow_event.id'],
        ),
        sa.ForeignKeyConstraint(
            ['active_tow_event_serving_id'],
            ['tow_event.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('phone'))
    op.create_table(
        'tow_request', sa.Column('id', sa.String(length=32), nullable=False),
        sa.Column('tow_request_batch_id', sa.String(length=32), nullable=True),
        sa.Column('requestor_location', sa.String(length=32), nullable=True),
        sa.Column('requestee_id', sa.String(length=32), nullable=True),
        sa.Column('requestee_location', sa.String(length=32), nullable=True),
        sa.Column('time_sent', sa.DateTime(), nullable=True),
        sa.Column('rejection_time', sa.DateTime(), nullable=True),
        sa.Column('cancelled_time', sa.DateTime(), nullable=True),
        sa.Column('tow_event_id', sa.String(length=32), nullable=True),
        sa.Column('status', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['tow_request_batch_id'],
            ['tow_request_batch.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'terraintracker_boat',
        sa.Column('id', sa.String(length=32), nullable=False),
        sa.Column('user_id', sa.String(length=32), nullable=True),
        sa.Column('model', sa.String(length=32), nullable=True),
        sa.Column('engine_hp', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['terraintracker_user.id'],
        ), sa.PrimaryKeyConstraint('id'))
Exemplo n.º 3
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'app_user',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('date_created',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('date_updated',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('email', sa.String(), nullable=False),
        sa.Column('pw_hash', sa.String(), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'))
    op.create_table(
        'food_category',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('uniform_name', sa.String(), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uniform_name'))
    op.create_table(
        'packaging_kind',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('uniform_name', sa.String(), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uniform_name'))
    op.create_table(
        'packaging_state',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('uniform_name', sa.String(), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uniform_name'))
    op.create_table(
        'revoked_token',
        sa.Column('jti', postgresql.UUID(as_uuid=True), nullable=False),
        sa.PrimaryKeyConstraint('jti'))
    op.create_table(
        'unit_of_measurement',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('uniform_name', sa.String(), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uniform_name'))
    op.create_table(
        'food_kind',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('name', sa.String(), nullable=False),
        sa.Column('uniform_name', sa.String(), nullable=False),
        sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
        sa.Column('unit_of_measurement_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=True),
        sa.Column('serving_size', sa.Float(), nullable=True),
        sa.ForeignKeyConstraint(
            ['unit_of_measurement_id'],
            ['unit_of_measurement.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['app_user.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uniform_name'))
    op.create_table(
        'stock', sa.Column('id', postgresql.UUID(as_uuid=True),
                           nullable=False),
        sa.Column('date_created',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('date_updated',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True), sa.Column('name',
                                            sa.String(),
                                            nullable=False),
        sa.Column('uniform_name', sa.String(), nullable=False),
        sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['app_user.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uniform_name'))
    op.create_table(
        'food_kind_category',
        sa.Column('food_kind_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=False),
        sa.Column('food_category_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['food_category_id'],
            ['food_category.id'],
        ), sa.ForeignKeyConstraint(
            ['food_kind_id'],
            ['food_kind.id'],
        ), sa.PrimaryKeyConstraint('food_kind_id', 'food_category_id'))
    op.create_table(
        'food_kind_nutrition_info',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('date_created',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('date_updated',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('food_kind_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=False),
        sa.Column('calories_per_serving', sa.Integer(), nullable=True),
        sa.Column('notes', sa.String(), nullable=True),
        sa.ForeignKeyConstraint(
            ['food_kind_id'],
            ['food_kind.id'],
        ), sa.PrimaryKeyConstraint('id', 'food_kind_id'))
    op.create_table(
        'snapshot',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('date_created',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('date_updated',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('stock_id', postgresql.UUID(as_uuid=True), nullable=True),
        sa.ForeignKeyConstraint(
            ['stock_id'],
            ['stock.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'stock_item',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('date_created',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('date_updated',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('stock_id', postgresql.UUID(as_uuid=True), nullable=True),
        sa.Column('food_kind_id', postgresql.UUID(as_uuid=True),
                  nullable=True),
        sa.Column('date_item_was_new', sa.DATE(), nullable=True),
        sa.Column('expiration_date', sa.DATE(), nullable=False),
        sa.ForeignKeyConstraint(
            ['food_kind_id'],
            ['food_kind.id'],
        ), sa.ForeignKeyConstraint(
            ['stock_id'],
            ['stock.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'stock_item_state',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('date_created',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('date_updated',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('stock_item_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=True),
        sa.Column('packaging_kind_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=True),
        sa.Column('packaging_state_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=True),
        sa.Column('quantity', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['packaging_kind_id'],
            ['packaging_kind.id'],
        ),
        sa.ForeignKeyConstraint(
            ['packaging_state_id'],
            ['packaging_state.id'],
        ), sa.ForeignKeyConstraint(
            ['stock_item_id'],
            ['stock_item.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'snapshot_stock_item_state',
        sa.Column('snapshot_id', postgresql.UUID(as_uuid=True),
                  nullable=False),
        sa.Column('stock_item_state_id',
                  postgresql.UUID(as_uuid=True),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['snapshot_id'],
            ['snapshot.id'],
        ),
        sa.ForeignKeyConstraint(
            ['stock_item_state_id'],
            ['stock_item_state.id'],
        ), sa.PrimaryKeyConstraint('snapshot_id', 'stock_item_state_id'))
def upgrade():
    op.add_column("feed", sa.Column("http_timeout", sa.Float(), nullable=True))
    op.add_column("feed", sa.Column("parser_options", sa.String(), nullable=True))
    op.alter_column("system", "name", existing_type=sa.VARCHAR(), nullable=False)
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('pool', sa.Column('fee', sa.Float(), nullable=True))
Exemplo n.º 6
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('functional_descriptor',
    sa.Column('ID', sa.Integer(), nullable=False),
    sa.Column('Name', sa.String(length=512), nullable=True),
    sa.Column('Type_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['Type_id'], ['asset_type.ID'], ),
    sa.PrimaryKeyConstraint('ID')
    )
    op.create_table('inbuildings_config',
    sa.Column('ID', sa.Integer(), nullable=False),
    sa.Column('Site_id', sa.Integer(), nullable=True),
    sa.Column('Enabled', sa.Boolean(), nullable=True),
    sa.Column('Connection_key', sa.String(length=512), nullable=True),
    sa.ForeignKeyConstraint(['Site_id'], ['site.ID'], ),
    sa.PrimaryKeyConstraint('ID')
    )
    op.create_table('issue_history',
    sa.Column('ID', sa.Integer(), nullable=False),
    sa.Column('Issues', sa.Integer(), nullable=True),
    sa.Column('Timestamp_id', sa.Integer(), nullable=True),
    sa.Column('Site_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['Site_id'], ['site.ID'], ),
    sa.ForeignKeyConstraint(['Timestamp_id'], ['issue_history_timestamp.ID'], ),
    sa.PrimaryKeyConstraint('ID')
    )
    op.create_table('algo_asset_mapping',
    sa.Column('Asset_id', sa.Integer(), nullable=False),
    sa.Column('Algorithm_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['Algorithm_id'], ['algorithm.ID'], ),
    sa.ForeignKeyConstraint(['Asset_id'], ['asset.ID'], ),
    sa.PrimaryKeyConstraint('Asset_id', 'Algorithm_id')
    )
    op.create_table('algo_exclusions',
    sa.Column('Asset_id', sa.Integer(), nullable=False),
    sa.Column('Algorithm_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['Algorithm_id'], ['algorithm.ID'], ),
    sa.ForeignKeyConstraint(['Asset_id'], ['asset.ID'], ),
    sa.PrimaryKeyConstraint('Asset_id', 'Algorithm_id')
    )
    op.create_table('algo_function_mapping',
    sa.Column('Algorithm_id', sa.Integer(), nullable=False),
    sa.Column('FunctionalDescriptor_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['Algorithm_id'], ['algorithm.ID'], ),
    sa.ForeignKeyConstraint(['FunctionalDescriptor_id'], ['functional_descriptor.ID'], ),
    sa.PrimaryKeyConstraint('Algorithm_id', 'FunctionalDescriptor_id')
    )
    op.create_table('asset_function_mapping',
    sa.Column('Asset_id', sa.Integer(), nullable=False),
    sa.Column('FunctionalDescriptor_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['Asset_id'], ['asset.ID'], ),
    sa.ForeignKeyConstraint(['FunctionalDescriptor_id'], ['functional_descriptor.ID'], ),
    sa.PrimaryKeyConstraint('Asset_id', 'FunctionalDescriptor_id')
    )
    op.create_table('asset_point',
    sa.Column('ID', sa.Integer(), nullable=False),
    sa.Column('Name', sa.String(length=512), nullable=True),
    sa.Column('Asset_id', sa.Integer(), nullable=True),
    sa.Column('PointType_id', sa.Integer(), nullable=True),
    sa.Column('LoggedEntity_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['Asset_id'], ['asset.ID'], ),
    sa.ForeignKeyConstraint(['PointType_id'], ['point_type.ID'], ),
    sa.PrimaryKeyConstraint('ID')
    )
    op.create_table('inbuildings_asset',
    sa.Column('ID', sa.Integer(), nullable=False),
    sa.Column('Name', sa.String(length=512), nullable=True),
    sa.Column('Location', sa.String(length=512), nullable=True),
    sa.Column('Group', sa.String(length=512), nullable=True),
    sa.Column('Site_id', sa.Integer(), nullable=True),
    sa.Column('Asset_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['Asset_id'], ['asset.ID'], ),
    sa.ForeignKeyConstraint(['Site_id'], ['site.ID'], ),
    sa.PrimaryKeyConstraint('ID')
    )
    op.create_table('result',
    sa.Column('ID', sa.Integer(), nullable=False),
    sa.Column('First_timestamp', sa.DateTime(), nullable=True),
    sa.Column('Recent_timestamp', sa.DateTime(), nullable=True),
    sa.Column('Asset_id', sa.Integer(), nullable=True),
    sa.Column('Algorithm_id', sa.Integer(), nullable=True),
    sa.Column('Result', sa.Float(), nullable=True),
    sa.Column('Passed', sa.Boolean(), nullable=True),
    sa.Column('Active', sa.Boolean(), nullable=True),
    sa.Column('Acknowledged', sa.Boolean(), nullable=True),
    sa.Column('Occurances', sa.Integer(), nullable=True),
    sa.Column('Recent', sa.Boolean(), nullable=True),
    sa.Column('Notes', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['Algorithm_id'], ['algorithm.ID'], ),
    sa.ForeignKeyConstraint(['Asset_id'], ['asset.ID'], ),
    sa.PrimaryKeyConstraint('ID')
    )
    op.create_table('points_checked',
    sa.Column('Result_id', sa.Integer(), nullable=False),
    sa.Column('Point_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['Point_id'], ['asset_point.ID'], ),
    sa.ForeignKeyConstraint(['Result_id'], ['result.ID'], ),
    sa.PrimaryKeyConstraint('Result_id', 'Point_id')
    )
Exemplo n.º 7
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('card', sa.Column('height', sa.Float(), nullable=True))
    op.add_column('card', sa.Column('width', sa.Float(), nullable=True))
    op.add_column('card', sa.Column('x_position', sa.Float(), nullable=True))
    op.add_column('card', sa.Column('y_position', sa.Float(), nullable=True))
Exemplo n.º 8
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'cliente', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('nome', sa.String(length=150), nullable=False),
        sa.Column('telefone', sa.String(length=16), nullable=False),
        sa.Column('data_nasc', sa.Date(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'forma_pagamento', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('descricao', sa.String(length=150), nullable=False),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'servico', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('descricao', sa.String(length=100), nullable=False),
        sa.Column('valor', sa.Float(precision=15, asdecimal=2),
                  nullable=False), sa.PrimaryKeyConstraint('id'))
    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.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(
        'agenda', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('confirmado', sa.Boolean(), nullable=False),
        sa.Column('ausencia', sa.Boolean(), nullable=True),
        sa.Column('data_agenda_inicio', sa.DateTime(), nullable=False),
        sa.Column('data_agenda_fim', sa.DateTime(), nullable=False),
        sa.Column('valor_servico',
                  sa.Float(precision=15, asdecimal=2),
                  nullable=True),
        sa.Column('cliente_id', sa.Integer(), nullable=True),
        sa.Column('servico_id', sa.Integer(), nullable=True),
        sa.Column('forma_pagamento_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['cliente_id'],
            ['cliente.id'],
        ),
        sa.ForeignKeyConstraint(
            ['forma_pagamento_id'],
            ['forma_pagamento.id'],
        ), sa.ForeignKeyConstraint(
            ['servico_id'],
            ['servico.id'],
        ), sa.PrimaryKeyConstraint('id'))
    # ### end Alembic commands ###

    from app import db
    from app.modulos.user.models import User

    u = User()
    u.username = '******'
    u.email = '*****@*****.**'
    u.set_password('Cal$Desenv81')
    db.session.add(u)
    db.session.commit()
Exemplo n.º 9
0
    'Date': sa.Date(),
    'Scrap_time': sa.String(),
    'Update_time_GMT': sa.Time(),
    'Country_id': sa.Integer(),
    'Country': sa.String(),
    'Population': sa.Integer(),
    'TotalCases': sa.Integer(),
    'NewCases': sa.Integer(),
    'TotalDeaths': sa.Integer(),
    'NewDeaths': sa.Integer(),
    'TotalRecovered': sa.Integer(),
    'NewRecovered': sa.Integer(),
    'ActiveCases': sa.Integer(),
    'Serious,Critical': sa.Integer(),
    'Tot_Cases_1M_pop': sa.Integer(),
    'Deaths/1M pop': sa.Float(),
    'TotalTests': sa.Integer(),
    'Tests_1M_pop': sa.Integer(),
    'Continent_id': sa.Integer()
}

continents_parm = {
    'Date': sa.Date(),
    'Scrap_time': sa.String(),
    'Update_time_GMT': sa.Time(),
    'Continent_id': sa.Integer(),
    'Continent': sa.String(),
    'TotalCases': sa.Integer(),
    'NewCases': sa.Integer(),
    'TotalDeaths': sa.Integer(),
    'NewDeaths': sa.Integer(),
Exemplo n.º 10
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('category',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('order',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('order_item',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('price_tier',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.Column('email', sa.String(length=127), nullable=False),
    sa.Column('password', sa.String(length=255), nullable=False),
    sa.Column('admin', sa.Boolean(), nullable=False),
    sa.Column('store_name', sa.String(length=127), nullable=True),
    sa.Column('contact_name', sa.String(length=127), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('contact_name'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('store_name')
    )
    op.create_table('product',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=False),
    sa.Column('category_id', sa.Integer(), nullable=True),
    sa.Column('description', sa.String(length=500), nullable=False),
    sa.ForeignKeyConstraint(['category_id'], ['category.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('product_sku',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.Column('sku_code', sa.String(length=16), nullable=False),
    sa.Column('description', sa.String(length=500), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.Column('cost', sa.Float(), nullable=True),
    sa.Column('msrp', sa.Float(), nullable=True),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('product_sku_price',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_on', sa.DateTime(), nullable=False),
    sa.Column('updated_on', sa.DateTime(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.Column('price', sa.Float(), nullable=False),
    sa.ForeignKeyConstraint(['product_id'], ['product.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
Exemplo n.º 11
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('hawker_centre', sa.Column('latitude', sa.Float(), nullable=True))
    op.add_column('hawker_centre', sa.Column('longitude', sa.Float(), nullable=True))
Exemplo n.º 12
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column("person", sa.Column("weight", sa.Float(), nullable=True))
Exemplo n.º 13
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('prediction_models',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(), nullable=False),
                    sa.Column('abbreviation', sa.String(), nullable=False),
                    sa.Column('projection', sa.String(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('abbreviation', 'projection'),
                    comment='Identifies the Weather Prediction model')
    op.create_index(op.f('ix_prediction_models_id'),
                    'prediction_models', ['id'],
                    unique=False)
    op.create_table(
        'processed_model_run_files',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('url', sa.String(), nullable=False),
        sa.Column('create_date', sa.TIMESTAMP(timezone=True), nullable=False),
        sa.Column('update_date', sa.TIMESTAMP(timezone=True), nullable=False),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('url'),
        comment=
        'Record to indicate that a particular model run file has been processed.'
    )
    op.create_index(op.f('ix_processed_model_run_files_id'),
                    'processed_model_run_files', ['id'],
                    unique=False)
    op.create_table(
        'prediction_model_grid_subsets',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('prediction_model_id', sa.Integer(), nullable=False),
        sa.Column('geom',
                  geoalchemy2.types.Geometry(geometry_type='POLYGON',
                                             from_text='ST_GeomFromEWKT',
                                             name='geometry'),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['prediction_model_id'],
            ['prediction_models.id'],
        ),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('prediction_model_id', 'geom'),
        comment='Identify the vertices surrounding the area of interest')
    op.create_index(op.f('ix_prediction_model_grid_subsets_id'),
                    'prediction_model_grid_subsets', ['id'],
                    unique=False)
    op.create_table(
        'prediction_model_runs',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('prediction_model_id', sa.Integer(), nullable=False),
        sa.Column('prediction_run_timestamp',
                  sa.TIMESTAMP(timezone=True),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['prediction_model_id'],
            ['prediction_models.id'],
        ),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('prediction_model_id', 'prediction_run_timestamp'),
        comment='Identify which prediction model run (e.g.  2020 07 07 12:00).'
    )
    op.create_index(op.f('ix_prediction_model_runs_id'),
                    'prediction_model_runs', ['id'],
                    unique=False)
    op.create_table(
        'model_run_grid_subset_predictions',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('prediction_model_run_id', sa.Integer(), nullable=False),
        sa.Column('prediction_model_grid_subset_id',
                  sa.Integer(),
                  nullable=False),
        sa.Column('prediction_timestamp',
                  sa.TIMESTAMP(timezone=True),
                  nullable=False),
        sa.Column('tmp_tgl_2', postgresql.ARRAY(sa.Float()), nullable=True),
        sa.Column('rh_tgl_2', postgresql.ARRAY(sa.Float()), nullable=True),
        sa.ForeignKeyConstraint(
            ['prediction_model_grid_subset_id'],
            ['prediction_model_grid_subsets.id'],
        ),
        sa.ForeignKeyConstraint(
            ['prediction_model_run_id'],
            ['prediction_model_runs.id'],
        ),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('prediction_model_run_id',
                            'prediction_model_grid_subset_id',
                            'prediction_timestamp'),
        comment='The prediction for a grid subset of a particular model run.')
    op.create_index(op.f('ix_model_run_grid_subset_predictions_id'),
                    'model_run_grid_subset_predictions', ['id'],
                    unique=False)
def upgrade():
    op.create_table('approved_email',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('ident', sa.Unicode(), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_approved_email'))
    )
    op.create_table('arbitrary_charge',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('amount', sa.Integer(), nullable=False),
    sa.Column('what', sa.Unicode(), server_default='', nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.Column('reg_station', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_arbitrary_charge'))
    )
    op.create_table('email',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('fk_id', residue.UUID(), nullable=True),
    sa.Column('ident', sa.Unicode(), server_default='', nullable=False),
    sa.Column('model', sa.Unicode(), server_default='', nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.Column('subject', sa.Unicode(), server_default='', nullable=False),
    sa.Column('dest', sa.Unicode(), server_default='', nullable=False),
    sa.Column('body', sa.Unicode(), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_email'))
    )
    op.create_table('group',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('public_id', residue.UUID(), nullable=False),
    sa.Column('name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('tables', sa.Numeric(), server_default='0', nullable=False),
    sa.Column('address', sa.Unicode(), server_default='', nullable=False),
    sa.Column('website', sa.Unicode(), server_default='', nullable=False),
    sa.Column('wares', sa.Unicode(), server_default='', nullable=False),
    sa.Column('description', sa.Unicode(), server_default='', nullable=False),
    sa.Column('special_needs', sa.Unicode(), server_default='', nullable=False),
    sa.Column('amount_paid', sa.Integer(), server_default='0', nullable=False),
    sa.Column('amount_refunded', sa.Integer(), server_default='0', nullable=False),
    sa.Column('cost', sa.Integer(), server_default='0', nullable=False),
    sa.Column('auto_recalc', sa.Boolean(), server_default='True', nullable=False),
    sa.Column('can_add', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('admin_notes', sa.Unicode(), server_default='', nullable=False),
    sa.Column('status', sa.Integer(), server_default='172070601', nullable=False),
    sa.Column('registered', residue.UTCDateTime(), server_default=sa.text(utcnow_server_default), nullable=False),
    sa.Column('approved', residue.UTCDateTime(), nullable=True),
    sa.Column('leader_id', residue.UUID(), nullable=True),
    sa.ForeignKeyConstraint(['leader_id'], ['attendee.id'], name='fk_leader', use_alter=True),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_group'))
    )
    op.create_table('job',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('type', sa.Integer(), server_default='252034462', nullable=False),
    sa.Column('name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('description', sa.Unicode(), server_default='', nullable=False),
    sa.Column('location', sa.Integer(), nullable=False),
    sa.Column('start_time', residue.UTCDateTime(), nullable=False),
    sa.Column('duration', sa.Integer(), nullable=False),
    sa.Column('weight', sa.Float(), server_default='1', nullable=False),
    sa.Column('slots', sa.Integer(), nullable=False),
    sa.Column('restricted', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('extra15', sa.Boolean(), server_default='False', nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_job'))
    )
    op.create_table('page_view_tracking',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.Column('who', sa.Unicode(), server_default='', nullable=False),
    sa.Column('page', sa.Unicode(), server_default='', nullable=False),
    sa.Column('what', sa.Unicode(), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_page_view_tracking'))
    )
    op.create_table('tracking',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('fk_id', residue.UUID(), nullable=False),
    sa.Column('model', sa.Unicode(), server_default='', nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.Column('who', sa.Unicode(), server_default='', nullable=False),
    sa.Column('page', sa.Unicode(), server_default='', nullable=False),
    sa.Column('which', sa.Unicode(), server_default='', nullable=False),
    sa.Column('links', sa.Unicode(), server_default='', nullable=False),
    sa.Column('action', sa.Integer(), nullable=False),
    sa.Column('data', sa.Unicode(), server_default='', nullable=False),
    sa.Column('snapshot', sa.Unicode(), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_tracking'))
    )
    op.create_index(op.f('ix_tracking_fk_id'), 'tracking', ['fk_id'], unique=False)
    op.create_table('watch_list',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('first_names', sa.Unicode(), server_default='', nullable=False),
    sa.Column('last_name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('email', sa.Unicode(), server_default='', nullable=False),
    sa.Column('birthdate', sa.Date(), nullable=True),
    sa.Column('reason', sa.Unicode(), server_default='', nullable=False),
    sa.Column('action', sa.Unicode(), server_default='', nullable=False),
    sa.Column('active', sa.Boolean(), server_default='True', nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_watch_list'))
    )
    op.create_table('attendee',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('watchlist_id', residue.UUID(), nullable=True),
    sa.Column('group_id', residue.UUID(), nullable=True),
    sa.Column('placeholder', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('first_name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('last_name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('legal_name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('email', sa.Unicode(), server_default='', nullable=False),
    sa.Column('birthdate', sa.Date(), nullable=True),
    sa.Column('age_group', sa.Integer(), server_default='178244408', nullable=True),
    sa.Column('international', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('zip_code', sa.Unicode(), server_default='', nullable=False),
    sa.Column('address1', sa.Unicode(), server_default='', nullable=False),
    sa.Column('address2', sa.Unicode(), server_default='', nullable=False),
    sa.Column('city', sa.Unicode(), server_default='', nullable=False),
    sa.Column('region', sa.Unicode(), server_default='', nullable=False),
    sa.Column('country', sa.Unicode(), server_default='', nullable=False),
    sa.Column('no_cellphone', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('ec_name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('ec_phone', sa.Unicode(), server_default='', nullable=False),
    sa.Column('cellphone', sa.Unicode(), server_default='', nullable=False),
    sa.Column('interests', sa.Unicode(), server_default='', nullable=False),
    sa.Column('found_how', sa.Unicode(), server_default='', nullable=False),
    sa.Column('comments', sa.Unicode(), server_default='', nullable=False),
    sa.Column('for_review', sa.Unicode(), server_default='', nullable=False),
    sa.Column('admin_notes', sa.Unicode(), server_default='', nullable=False),
    sa.Column('public_id', residue.UUID(), nullable=False),
    sa.Column('badge_num', sa.Integer(), nullable=True),
    sa.Column('badge_type', sa.Integer(), server_default='51352218', nullable=False),
    sa.Column('badge_status', sa.Integer(), server_default='163076611', nullable=False),
    sa.Column('ribbon', sa.Integer(), server_default='154973361', nullable=False),
    sa.Column('affiliate', sa.Unicode(), server_default='', nullable=False),
    sa.Column('shirt', sa.Integer(), server_default='0', nullable=False),
    sa.Column('can_spam', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('regdesk_info', sa.Unicode(), server_default='', nullable=False),
    sa.Column('extra_merch', sa.Unicode(), server_default='', nullable=False),
    sa.Column('got_merch', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('reg_station', sa.Integer(), nullable=True),
    sa.Column('registered', residue.UTCDateTime(), server_default=sa.text(utcnow_server_default), nullable=False),
    sa.Column('checked_in', residue.UTCDateTime(), nullable=True),
    sa.Column('paid', sa.Integer(), server_default='121378471', nullable=False),
    sa.Column('overridden_price', sa.Integer(), nullable=True),
    sa.Column('amount_paid', sa.Integer(), server_default='0', nullable=False),
    sa.Column('amount_extra', sa.Integer(), server_default='0', nullable=False),
    sa.Column('payment_method', sa.Integer(), nullable=True),
    sa.Column('amount_refunded', sa.Integer(), server_default='0', nullable=False),
    sa.Column('badge_printed_name', sa.Unicode(), server_default='', nullable=False),
    sa.Column('staffing', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('requested_depts', sa.Unicode(), server_default='', nullable=False),
    sa.Column('assigned_depts', sa.Unicode(), server_default='', nullable=False),
    sa.Column('trusted_depts', sa.Unicode(), server_default='', nullable=False),
    sa.Column('nonshift_hours', sa.Integer(), server_default='0', nullable=False),
    sa.Column('past_years', sa.Unicode(), server_default='', nullable=False),
    sa.Column('can_work_setup', sa.Boolean(), server_default='False', nullable=False),
    sa.Column('can_work_teardown', sa.Boolean(), server_default='False', nullable=False),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], name=op.f('fk_attendee_group_id_group'), ondelete='SET NULL'),
    sa.ForeignKeyConstraint(['watchlist_id'], ['watch_list.id'], name=op.f('fk_attendee_watchlist_id_watch_list'), ondelete='set null'),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_attendee')),
    *[c for c in [sa.UniqueConstraint('badge_num', deferrable='True', initially='DEFERRED', name=op.f('uq_attendee_badge_num'))] if not is_sqlite]
    )
    op.create_table('admin_account',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('hashed', sa.Unicode(), server_default='', nullable=False),
    sa.Column('access', sa.Unicode(), server_default='', nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_admin_account_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_admin_account')),
    sa.UniqueConstraint('attendee_id', name=op.f('uq_admin_account_attendee_id'))
    )
    op.create_table('dept_checklist_item',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('slug', sa.Unicode(), server_default='', nullable=False),
    sa.Column('comments', sa.Unicode(), server_default='', nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_dept_checklist_item_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_dept_checklist_item')),
    sa.UniqueConstraint('attendee_id', 'slug', name='_dept_checklist_item_uniq')
    )
    op.create_table('food_restrictions',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('standard', sa.Unicode(), server_default='', nullable=False),
    sa.Column('sandwich_pref', sa.Unicode(), server_default='', nullable=False),
    sa.Column('freeform', sa.Unicode(), server_default='', nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_food_restrictions_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_food_restrictions')),
    sa.UniqueConstraint('attendee_id', name=op.f('uq_food_restrictions_attendee_id'))
    )
    op.create_table('m_points_for_cash',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('amount', sa.Integer(), nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_m_points_for_cash_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_m_points_for_cash'))
    )
    op.create_table('merch_discount',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('uses', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_merch_discount_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_merch_discount')),
    sa.UniqueConstraint('attendee_id', name=op.f('uq_merch_discount_attendee_id'))
    )
    op.create_table('merch_pickup',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('picked_up_by_id', residue.UUID(), nullable=False),
    sa.Column('picked_up_for_id', residue.UUID(), nullable=False),
    sa.ForeignKeyConstraint(['picked_up_by_id'], ['attendee.id'], name=op.f('fk_merch_pickup_picked_up_by_id_attendee')),
    sa.ForeignKeyConstraint(['picked_up_for_id'], ['attendee.id'], name=op.f('fk_merch_pickup_picked_up_for_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_merch_pickup')),
    sa.UniqueConstraint('picked_up_for_id', name=op.f('uq_merch_pickup_picked_up_for_id'))
    )
    op.create_table('no_shirt',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_no_shirt_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_no_shirt')),
    sa.UniqueConstraint('attendee_id', name=op.f('uq_no_shirt_attendee_id'))
    )
    op.create_table('old_m_point_exchange',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('amount', sa.Integer(), nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_old_m_point_exchange_attendee_id_attendee')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_old_m_point_exchange'))
    )
    op.create_table('sale',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=True),
    sa.Column('what', sa.Unicode(), server_default='', nullable=False),
    sa.Column('cash', sa.Integer(), server_default='0', nullable=False),
    sa.Column('mpoints', sa.Integer(), server_default='0', nullable=False),
    sa.Column('when', residue.UTCDateTime(), nullable=False),
    sa.Column('reg_station', sa.Integer(), nullable=True),
    sa.Column('payment_method', sa.Integer(), server_default='251700478', nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_sale_attendee_id_attendee'), ondelete='set null'),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_sale'))
    )
    op.create_table('shift',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('job_id', residue.UUID(), nullable=False),
    sa.Column('attendee_id', residue.UUID(), nullable=False),
    sa.Column('worked', sa.Integer(), server_default='176686787', nullable=False),
    sa.Column('rating', sa.Integer(), server_default='54944008', nullable=False),
    sa.Column('comment', sa.Unicode(), server_default='', nullable=False),
    sa.ForeignKeyConstraint(['attendee_id'], ['attendee.id'], name=op.f('fk_shift_attendee_id_attendee'), ondelete='cascade'),
    sa.ForeignKeyConstraint(['job_id'], ['job.id'], name=op.f('fk_shift_job_id_job'), ondelete='cascade'),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_shift'))
    )
    op.create_table('password_reset',
    sa.Column('id', residue.UUID(), nullable=False),
    sa.Column('account_id', residue.UUID(), nullable=False),
    sa.Column('generated', residue.UTCDateTime(), server_default=sa.text(utcnow_server_default), nullable=False),
    sa.Column('hashed', sa.Unicode(), server_default='', nullable=False),
    sa.ForeignKeyConstraint(['account_id'], ['admin_account.id'], name=op.f('fk_password_reset_account_id_admin_account')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_password_reset')),
    sa.UniqueConstraint('account_id', name=op.f('uq_password_reset_account_id'))
    )
Exemplo n.º 15
0
def upgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('movie', sa.Column('avg_rating', sa.Float(), nullable=True))
Exemplo n.º 16
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'flights',
        sa.Column('flight_number',
                  sa.String(length=20),
                  nullable=True,
                  comment='航班号,例:CN9985'),
        sa.Column('lowest_price',
                  sa.Integer(),
                  nullable=True,
                  comment='该航班最低价格'),
        sa.Column('plane_type_code',
                  sa.String(length=20),
                  nullable=True,
                  comment='飞机型号代码'),
        sa.Column('airline_code',
                  sa.String(length=20),
                  nullable=True,
                  comment='航空公司代码'),
        sa.Column('departure_city_code',
                  sa.String(length=10),
                  nullable=True,
                  comment='出发城市代码'),
        sa.Column('departure_airport_code',
                  sa.String(length=10),
                  nullable=True,
                  comment='出发机场代码'),
        sa.Column('departure_terminal_id',
                  sa.Integer(),
                  nullable=True,
                  comment='出发航站楼代码'),
        sa.Column('arrival_city_code',
                  sa.String(length=10),
                  nullable=True,
                  comment='到达城市代码'),
        sa.Column('arrival_airport_code',
                  sa.String(length=10),
                  nullable=True,
                  comment='到达机场代码'),
        sa.Column('arrival_terminal_id',
                  sa.Integer(),
                  nullable=True,
                  comment='到达航站楼代码'),
        sa.Column('depart_at',
                  sa.DateTime(timezone=True),
                  nullable=True,
                  comment='计划起飞时间'),
        sa.Column('arrive_at',
                  sa.DateTime(timezone=True),
                  nullable=True,
                  comment='计划降落时间'),
        sa.Column('punctual_rate', sa.Float(), nullable=True, comment='准点率'),
        sa.Column('stop_times',
                  sa.SmallInteger(),
                  nullable=True,
                  comment='经停次数'),
        sa.Column('source', sa.String(length=1), nullable=True,
                  comment='数据来源'),
        sa.Column('search_at',
                  sa.DateTime(timezone=True),
                  nullable=True,
                  comment='查询时间'))
Exemplo n.º 17
0
def upgrade():
    """
    To upgrade we need to split the grade_cell and solution_cell database
    entries into a part in base_cell and a part in either grade_cell or
    solution_cell. Because the names are the same for the new and old
    grade_cell and solution_cell tables we create temporary tables
    'grade_cells' and 'solution_cells' and once the transfer has occured
    we drop the old tables and rename the temporary tables to the
    original names.
    """
    new_grade_table = _get_or_create_table(
        'grade_cells',
        sa.Column('id', sa.VARCHAR(32), nullable=False),
        sa.Column('max_score', sa.Float(), nullable=False),
        sa.Column('cell_type', sa.VARCHAR(8), nullable=False),
    )

    new_solution_table = _get_or_create_table(
        'solution_cells',
        sa.Column('id', sa.VARCHAR(32), nullable=False),
    )

    old_grade_table = sa.Table(
        'grade_cell',
        sa.MetaData(),
        sa.Column('id', sa.VARCHAR(32), nullable=False),
        sa.Column('name', sa.VARCHAR(128), nullable=False),
        sa.Column('max_score', sa.Float(), nullable=False),
        sa.Column('cell_type', sa.VARCHAR(8), nullable=False),
        sa.Column('notebook_id', sa.VARCHAR(32)),
    )

    old_solution_table = sa.Table(
        'solution_cell',
        sa.MetaData(),
        sa.Column('id', sa.VARCHAR(32), nullable=False),
        sa.Column('name', sa.VARCHAR(128), nullable=False),
        sa.Column('max_score', sa.Float(), nullable=False),
        sa.Column('cell_type', sa.VARCHAR(8), nullable=False),
        sa.Column('notebook_id', sa.VARCHAR(32)),
    )

    base_cell_table = _get_or_create_table(
        'base_cell', sa.Column('id', sa.VARCHAR(32), nullable=False),
        sa.Column('name', sa.VARCHAR(128), nullable=False),
        sa.Column('notebook_id', sa.VARCHAR(32)),
        sa.Column('type', sa.VARCHAR(50)))

    connection = op.get_bind()
    results = connection.execute(
        sa.select([
            old_grade_table.c.name, old_grade_table.c.id,
            old_grade_table.c.cell_type, old_grade_table.c.notebook_id,
            old_grade_table.c.max_score
        ])).fetchall()

    # copy info to the base_cell table
    base_grade_cells = [{
        'name': name,
        'id': cellid,
        'type': 'GradeCell',
        'notebook_id': notebook_id,
    } for name, cellid, _, notebook_id, _ in results]

    op.bulk_insert(base_cell_table, base_grade_cells)

    # copy the grade_cell specific info to the grade_cells temporary database
    grade_cells = [{
        'id': cellid,
        'cell_type': celltype,
        'max_score': max_score,
    } for _, cellid, celltype, _, max_score in results]

    op.bulk_insert(new_grade_table, grade_cells)

    # now transfer the solution cells...
    results = connection.execute(
        sa.select([
            old_solution_table.c.name,
            old_solution_table.c.id,
            old_solution_table.c.notebook_id,
        ])).fetchall()

    # copy info to the base_cell table
    base_solution_cells = [{
        'name': name,
        'id': cellid,
        'type': 'SolutionCell',
        'notebook_id': notebook_id,
    } for name, cellid, notebook_id in results]

    op.bulk_insert(base_cell_table, base_solution_cells)

    # copy the solution_cell specific info to the solution_cells
    # temporary database
    solution_cells = [{
        'id': cellid,
    } for _, cellid, _ in results]

    op.bulk_insert(new_solution_table, solution_cells)

    # drop the old tables
    op.drop_table(u'grade_cell')
    op.drop_table(u'solution_cell')
Exemplo n.º 18
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('LANGUAGE',
                    sa.Column('id', sa.String(length=5), nullable=False),
                    sa.Column('name', sa.String(length=32), nullable=False),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'USER', sa.Column('uuid',
                          postgresql.UUID(as_uuid=True),
                          nullable=False),
        sa.Column('email', sa.String(length=60), nullable=False),
        sa.Column('password', sa.String(length=60), nullable=False),
        sa.Column('firstname', sa.String(length=32), nullable=False),
        sa.Column('lastname', sa.String(length=32), nullable=False),
        sa.Column('customer_rating', sa.Float(), nullable=True),
        sa.Column('guide_rating', sa.Float(), nullable=True),
        sa.Column('bio', sa.Text(), nullable=True),
        sa.PrimaryKeyConstraint('uuid'), sa.UniqueConstraint('uuid'))
    op.create_table(
        'TOUR', sa.Column('uuid',
                          postgresql.UUID(as_uuid=True),
                          nullable=False),
        sa.Column('guide_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('title', sa.String(length=32), nullable=False),
        sa.Column('description', sa.Text(), nullable=True),
        sa.Column('rating', sa.Float(), nullable=True),
        sa.Column('upload_time', sa.DateTime(), nullable=True),
        sa.Column('price', sa.Float(), nullable=False),
        sa.Column('duration', sa.Interval(), nullable=False),
        sa.ForeignKeyConstraint(
            ['guide_id'],
            ['USER.uuid'],
        ), sa.PrimaryKeyConstraint('uuid'), sa.UniqueConstraint('uuid'))
    op.create_table(
        'VERNACULAR', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('language_id', sa.String(length=5), nullable=False),
        sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.ForeignKeyConstraint(
            ['language_id'],
            ['LANGUAGE.id'],
        ), sa.ForeignKeyConstraint(
            ['user_id'],
            ['USER.uuid'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'LOCATION', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('tour_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('name', sa.String(length=60), nullable=True),
        sa.Column('address', sa.String(length=60), nullable=True),
        sa.Column('lat', sa.Float(), nullable=False),
        sa.Column('lng', sa.Float(), nullable=False),
        sa.ForeignKeyConstraint(
            ['tour_id'],
            ['TOUR.uuid'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'TOUR_DATE', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('tour_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('tour_date', sa.DateTime(), nullable=False),
        sa.ForeignKeyConstraint(
            ['tour_id'],
            ['TOUR.uuid'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'TOUR_IMAGE', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('tour_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('title', sa.String(length=32), nullable=False),
        sa.Column('description', sa.Text(), nullable=False),
        sa.Column('date', sa.Date(), nullable=False),
        sa.Column('image', sa.LargeBinary(), nullable=False),
        sa.ForeignKeyConstraint(
            ['tour_id'],
            ['TOUR.uuid'],
        ), sa.PrimaryKeyConstraint('id'))
Exemplo n.º 19
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('Cities', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('label', sa.String(length=200), nullable=False),
                    sa.Column('created_at', sa.Integer(), nullable=True),
                    sa.Column('updated_at', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('Countries', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('label', sa.String(length=200), nullable=False),
                    sa.Column('created_at', sa.Integer(), nullable=True),
                    sa.Column('updated_at', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'Customers', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=100), nullable=True),
        sa.Column('description', sa.String(length=200), nullable=True),
        sa.Column('login', sa.String(length=100), nullable=False),
        sa.Column('password', sa.String(length=100), nullable=False),
        sa.Column('email', sa.String(length=50), nullable=False),
        sa.Column('email_confirm', sa.String(length=12), nullable=True),
        sa.Column('phone', sa.String(length=20), nullable=False),
        sa.Column('phone_confirm', sa.String(length=12), nullable=True),
        sa.Column('country_id', sa.Integer(), nullable=True),
        sa.Column('city_id', sa.Integer(), nullable=True),
        sa.Column('address', sa.String(length=200), nullable=True),
        sa.Column('mail_agreement', sa.Boolean(), nullable=True),
        sa.Column('flags', sa.Integer(), nullable=True),
        sa.Column('data', sa.JSON(), nullable=True),
        sa.Column('created_at', sa.Integer(), nullable=True),
        sa.Column('updated_at', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['city_id'],
            ['Cities.id'],
        ), sa.ForeignKeyConstraint(
            ['country_id'],
            ['Countries.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('login'),
        sa.UniqueConstraint('login', 'email'), sa.UniqueConstraint('phone'))
    op.create_table(
        'Users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=100), nullable=True),
        sa.Column('organization', sa.String(length=200), nullable=True),
        sa.Column('description', sa.String(length=200), nullable=True),
        sa.Column('login', sa.String(length=100), nullable=False),
        sa.Column('password', sa.String(length=100), nullable=False),
        sa.Column('email', sa.String(length=50), nullable=False),
        sa.Column('email_confirm', sa.String(length=12), nullable=True),
        sa.Column('phone', sa.String(length=20), nullable=False),
        sa.Column('phone_confirm', sa.String(length=12), nullable=True),
        sa.Column('country_id', sa.Integer(), nullable=True),
        sa.Column('city_id', sa.Integer(), nullable=True),
        sa.Column('address', sa.String(length=200), nullable=True),
        sa.Column('mail_agreement', sa.Boolean(), nullable=True),
        sa.Column('flags', sa.Integer(), nullable=True),
        sa.Column('data', sa.JSON(), nullable=True),
        sa.Column('created_at', sa.Integer(), nullable=True),
        sa.Column('updated_at', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['city_id'],
            ['Cities.id'],
        ), sa.ForeignKeyConstraint(
            ['country_id'],
            ['Countries.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('login'),
        sa.UniqueConstraint('login', 'email'), sa.UniqueConstraint('phone'))
    op.create_table(
        'Schedules', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=100), nullable=False),
        sa.Column('description', sa.String(length=200), nullable=True),
        sa.Column('email', sa.String(length=50), nullable=True),
        sa.Column('phone', sa.String(length=20), nullable=True),
        sa.Column('creater_id', sa.Integer(), nullable=False),
        sa.Column('country_id', sa.Integer(), nullable=True),
        sa.Column('city_id', sa.Integer(), nullable=True),
        sa.Column('address', sa.String(length=200), nullable=True),
        sa.Column('flags', sa.Integer(), nullable=True),
        sa.Column('data', sa.JSON(), nullable=True),
        sa.Column('activate', sa.Boolean(), nullable=False),
        sa.Column('created_at', sa.Integer(), nullable=True),
        sa.Column('updated_at', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['city_id'],
            ['Cities.id'],
        ), sa.ForeignKeyConstraint(
            ['country_id'],
            ['Countries.id'],
        ), sa.ForeignKeyConstraint(
            ['creater_id'],
            ['Users.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'),
        sa.UniqueConstraint('name'))
    op.create_table(
        'Orders', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('time', sa.Integer(), nullable=False),
        sa.Column('schedule_id', sa.Integer(), nullable=False),
        sa.Column('customer_id', sa.Integer(), nullable=True),
        sa.Column('description', sa.String(length=200), nullable=True),
        sa.Column('status', sa.Integer(), nullable=False),
        sa.Column('paiment', sa.Boolean(), nullable=True),
        sa.Column('auto_confirm', sa.Boolean(), nullable=True),
        sa.Column('created_at', sa.Integer(), nullable=True),
        sa.Column('updated_at', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['customer_id'],
            ['Customers.id'],
        ),
        sa.ForeignKeyConstraint(['schedule_id'], ['Schedules.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'SCHDetails', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('time', sa.Integer(), nullable=False),
        sa.Column('description', sa.String(length=200), nullable=True),
        sa.Column('members', sa.Integer(), nullable=False),
        sa.Column('price', sa.Float(), nullable=False),
        sa.Column('schedule_id', sa.Integer(), nullable=False),
        sa.Column('created_at', sa.Integer(), nullable=True),
        sa.Column('updated_at', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['schedule_id'], ['Schedules.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
Exemplo n.º 20
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'client', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date_created', sa.DateTime(), nullable=True),
        sa.Column('date_modified', sa.DateTime(), nullable=True),
        sa.Column('first_name', sa.String(length=100), nullable=False),
        sa.Column('last_name', sa.String(length=100), nullable=False),
        sa.Column('middle_name', sa.String(length=100), nullable=True),
        sa.Column('address', sa.String(length=100), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_client_first_name'),
                    'client', ['first_name'],
                    unique=False)
    op.create_index(op.f('ix_client_last_name'),
                    'client', ['last_name'],
                    unique=False)
    op.create_table(
        'lot_price', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date_created', sa.DateTime(), nullable=True),
        sa.Column('date_modified', sa.DateTime(), nullable=True),
        sa.Column('price_per_sq_mtr', sa.Float(), nullable=True),
        sa.Column('date_price_effective', sa.Date(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'section', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date_created', sa.DateTime(), nullable=True),
        sa.Column('date_modified', sa.DateTime(), nullable=True),
        sa.Column('name', sa.String(length=10), nullable=True),
        sa.Column('area',
                  geoalchemy2.types.Geometry(geometry_type='POLYGON'),
                  nullable=False), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_section_name'), 'section', ['name'], unique=False)
    op.create_table(
        'block', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date_created', sa.DateTime(), nullable=True),
        sa.Column('date_modified', sa.DateTime(), nullable=True),
        sa.Column('section_id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=10), nullable=True),
        sa.Column('area',
                  geoalchemy2.types.Geometry(geometry_type='POLYGON'),
                  nullable=False),
        sa.ForeignKeyConstraint(
            ['section_id'],
            ['section.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_block_name'), 'block', ['name'], unique=False)
    op.create_table(
        'lot', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date_created', sa.DateTime(), nullable=True),
        sa.Column('date_modified', sa.DateTime(), nullable=True),
        sa.Column('block_id', sa.Integer(), nullable=False),
        sa.Column('client_id', sa.Integer(), nullable=False),
        sa.Column('area',
                  geoalchemy2.types.Geometry(geometry_type='POLYGON'),
                  nullable=False),
        sa.Column('dimension', sa.String(length=20), nullable=True),
        sa.Column('lot_area', sa.Float(), nullable=True),
        sa.Column('price_per_sq_mtr', sa.Float(), nullable=True),
        sa.Column('date_purchased', sa.Date(), nullable=True),
        sa.Column('status', sa.String(length=20), nullable=True),
        sa.ForeignKeyConstraint(
            ['block_id'],
            ['block.id'],
        ), sa.ForeignKeyConstraint(
            ['client_id'],
            ['client.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_lot_block_id'), 'lot', ['block_id'], unique=False)
    op.create_index(op.f('ix_lot_client_id'),
                    'lot', ['client_id'],
                    unique=False)
    op.create_index(op.f('ix_lot_status'), 'lot', ['status'], unique=False)
    op.create_table(
        'deceased', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date_created', sa.DateTime(), nullable=True),
        sa.Column('date_modified', sa.DateTime(), nullable=True),
        sa.Column('first_name', sa.String(length=100), nullable=False),
        sa.Column('last_name', sa.String(length=100), nullable=False),
        sa.Column('middle_name', sa.String(length=100), nullable=True),
        sa.Column('lot_id', sa.Integer(), nullable=False),
        sa.Column('date_of_death', sa.Date(), nullable=True),
        sa.ForeignKeyConstraint(
            ['lot_id'],
            ['lot.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_deceased_first_name'),
                    'deceased', ['first_name'],
                    unique=False)
    op.create_index(op.f('ix_deceased_last_name'),
                    'deceased', ['last_name'],
                    unique=False)
    op.create_index(op.f('ix_deceased_lot_id'),
                    'deceased', ['lot_id'],
                    unique=False)
Exemplo n.º 21
0
    IDColumn(),
    sa.Column('sess_id', sa.String(length=64), unique=False, index=True),
    sa.Column('role', sa.String(length=16), nullable=False, default='master'),
    sa.Column('agent', sa.String(length=64), sa.ForeignKey('agents.id')),
    sa.Column('agent_addr', sa.String(length=128), nullable=False),
    sa.Column('access_key', sa.String(length=20),
              sa.ForeignKey('keypairs.access_key')),
    sa.Column('lang', sa.String(length=512)),
    sa.Column('tag', sa.String(length=64), nullable=True),

    # Resource occupation
    sa.Column('container_id', sa.String(length=64)),
    sa.Column('cpu_set', sa.ARRAY(sa.Integer)),
    sa.Column('gpu_set', sa.ARRAY(sa.Integer)),
    sa.Column('mem_slot', sa.BigInteger(), nullable=False),
    sa.Column('cpu_slot', sa.Float(), nullable=False),
    sa.Column('gpu_slot', sa.Float(), nullable=False),
    sa.Column('environ', sa.ARRAY(sa.String), nullable=True),

    # Port mappings
    # If kernel_host is NULL, it is assumed to be same to the agent host or IP.
    sa.Column('kernel_host', sa.String(length=128), nullable=True),
    sa.Column('repl_in_port', sa.Integer(), nullable=False),
    sa.Column('repl_out_port', sa.Integer(), nullable=False),
    sa.Column('stdin_port', sa.Integer(), nullable=False),
    sa.Column('stdout_port', sa.Integer(), nullable=False),

    # Lifecycle
    sa.Column('created_at',
              sa.DateTime(timezone=True),
              server_default=sa.func.now(),
Exemplo n.º 22
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('categories', sa.Column('id', sa.Integer(),
                                            nullable=False),
                    sa.Column('name', sa.String(length=20), nullable=True),
                    sa.Column('parent', sa.Integer(), nullable=True),
                    sa.Column('order', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_categories_id'),
                    'categories', ['id'],
                    unique=False)
    op.create_table(
        'users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=20), nullable=True),
        sa.Column('email', sa.String(length=30), nullable=True),
        sa.Column('phone', sa.String(length=15), nullable=True),
        sa.Column('password_hash', sa.String(length=128), nullable=True),
        sa.Column('oauth',
                  sa.Enum('NONE',
                          'GOOGLE',
                          'TWITTER',
                          'FACEBOOK',
                          'INSTAGRAM',
                          name='oauth'),
                  nullable=True),
        sa.Column('profile_image', sa.String(length=20), nullable=False),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False)
    op.create_index(op.f('ix_users_phone'), 'users', ['phone'], unique=True)
    op.create_index(op.f('ix_users_username'),
                    'users', ['username'],
                    unique=True)
    op.create_table(
        'adverts', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('date', sa.DateTime(), nullable=False),
        sa.Column('title', sa.String(length=50), nullable=False),
        sa.Column('text', sa.String(length=500), nullable=False),
        sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=True),
        sa.Column('condition',
                  sa.Enum('NONE', 'OLD', 'USED', 'NEW', name='condition'),
                  nullable=True),
        sa.Column('location', sa.String(length=20), nullable=True),
        sa.Column('hide', sa.Boolean(), nullable=False),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['users.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_adverts_id'), 'adverts', ['id'], unique=False)
    op.create_table(
        'advert_category', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('advert_id', sa.Integer(), nullable=False),
        sa.Column('category1', sa.Integer(), nullable=True),
        sa.Column('category2', sa.Integer(), nullable=True),
        sa.Column('category3', sa.Integer(), nullable=True),
        sa.Column('brand', sa.String(length=20), nullable=True),
        sa.Column('size', sa.Float(), nullable=True),
        sa.Column('price', sa.Numeric(precision=10, scale=2), nullable=True),
        sa.Column('timestamp', sa.DateTime(timezone=True), nullable=False),
        sa.ForeignKeyConstraint(
            ['advert_id'],
            ['adverts.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_advert_category_id'),
                    'advert_category', ['id'],
                    unique=False)
    op.create_table('images', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('advert_id', sa.Integer(), nullable=False),
                    sa.Column('image', sa.String(length=20), nullable=False),
                    sa.Column('title', sa.String(length=20), nullable=True),
                    sa.Column('order', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['advert_id'],
                        ['adverts.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_images_id'), 'images', ['id'], unique=False)
Exemplo n.º 23
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('event_status',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('status', sa.String(length=45), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('status')
    )
    op.create_table('org_unit',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('province', sa.String(length=45), nullable=False),
    sa.Column('district', sa.String(length=45), nullable=False),
    sa.Column('name', sa.String(length=45), nullable=False),
    sa.Column('contact', sa.String(length=10), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('patient_status',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('status', sa.String(length=45), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('status')
    )
    op.create_table('province',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=45), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('telephone', sa.String(length=10), nullable=False),
    sa.Column('first_name', sa.String(length=45), nullable=False),
    sa.Column('last_name', sa.String(length=45), nullable=False),
    sa.Column('nic_number', sa.String(length=20), nullable=True),
    sa.Column('email', sa.String(length=45), nullable=True),
    sa.Column('password', sa.String(length=45), nullable=False),
    sa.Column('salt', sa.String(length=45), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('telephone')
    )
    op.create_table('admin',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=45), nullable=False),
    sa.Column('name', sa.String(length=45), nullable=False),
    sa.Column('contact', sa.String(length=10), nullable=False),
    sa.Column('password', sa.String(length=70), nullable=False),
    sa.Column('org_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['org_id'], ['org_unit.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('district',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('province_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=45), nullable=False),
    sa.ForeignKeyConstraint(['province_id'], ['province.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('alert',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=False),
    sa.Column('alert_type', sa.String(length=45), nullable=False),
    sa.Column('subject', sa.String(length=45), nullable=False),
    sa.Column('description', sa.String(length=500), nullable=False),
    sa.Column('org_id', sa.Integer(), nullable=False),
    sa.Column('creator_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['creator_id'], ['admin.id'], ),
    sa.ForeignKeyConstraint(['org_id'], ['org_unit.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('event',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=45), nullable=False),
    sa.Column('venue', sa.String(length=45), nullable=False),
    sa.Column('location_lat', sa.Float(), nullable=False),
    sa.Column('location_long', sa.Float(), nullable=False),
    sa.Column('date_created', sa.DateTime(), nullable=False),
    sa.Column('start_time', sa.DateTime(), nullable=False),
    sa.Column('duration', sa.Float(), nullable=False),
    sa.Column('coordinator_name', sa.String(length=45), nullable=False),
    sa.Column('coordinator_contact', sa.Integer(), nullable=False),
    sa.Column('status_id', sa.Integer(), nullable=False),
    sa.Column('org_id', sa.Integer(), nullable=False),
    sa.Column('created_by', sa.Integer(), nullable=False),
    sa.Column('description', sa.String(length=500), nullable=False),
    sa.ForeignKeyConstraint(['created_by'], ['admin.id'], ),
    sa.ForeignKeyConstraint(['org_id'], ['org_unit.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['event_status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('incident',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('province', sa.String(length=45), nullable=False),
    sa.Column('district', sa.String(length=45), nullable=False),
    sa.Column('city', sa.String(length=45), nullable=False),
    sa.Column('location_lat', sa.Float(), nullable=True),
    sa.Column('location_long', sa.Float(), nullable=True),
    sa.Column('patient_name', sa.String(length=45), nullable=False),
    sa.Column('patient_gender', sa.String(length=1), nullable=False),
    sa.Column('patient_dob', sa.DateTime(), nullable=False),
    sa.Column('description', sa.String(length=200), nullable=True),
    sa.Column('reported_time', sa.DateTime(), nullable=False),
    sa.Column('reported_user_id', sa.Integer(), nullable=False),
    sa.Column('patient_status_id', sa.Integer(), nullable=False),
    sa.Column('is_verified', sa.Integer(), nullable=False),
    sa.Column('verified_by', sa.Integer(), nullable=True),
    sa.Column('org_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['org_id'], ['org_unit.id'], ),
    sa.ForeignKeyConstraint(['patient_status_id'], ['patient_status.id'], ),
    sa.ForeignKeyConstraint(['reported_user_id'], ['user.id'], ),
    sa.ForeignKeyConstraint(['verified_by'], ['admin.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "bill_version",
        sa.Column("id", sa.Integer(), autoincrement=False, nullable=False),
        sa.Column("payer_id", sa.Integer(), autoincrement=False, nullable=True),
        sa.Column("amount", sa.Float(), autoincrement=False, nullable=True),
        sa.Column("date", sa.Date(), autoincrement=False, nullable=True),
        sa.Column("creation_date", sa.Date(), autoincrement=False, nullable=True),
        sa.Column("what", sa.UnicodeText(), autoincrement=False, nullable=True),
        sa.Column(
            "external_link", sa.UnicodeText(), autoincrement=False, nullable=True
        ),
        sa.Column("archive", sa.Integer(), autoincrement=False, nullable=True),
        sa.Column(
            "transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
        ),
        sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
        sa.Column("operation_type", sa.SmallInteger(), nullable=False),
        sa.PrimaryKeyConstraint("id", "transaction_id"),
    )
    op.create_index(
        op.f("ix_bill_version_end_transaction_id"),
        "bill_version",
        ["end_transaction_id"],
        unique=False,
    )
    op.create_index(
        op.f("ix_bill_version_operation_type"),
        "bill_version",
        ["operation_type"],
        unique=False,
    )
    op.create_index(
        op.f("ix_bill_version_transaction_id"),
        "bill_version",
        ["transaction_id"],
        unique=False,
    )
    op.create_table(
        "billowers_version",
        sa.Column("bill_id", sa.Integer(), autoincrement=False, nullable=False),
        sa.Column("person_id", sa.Integer(), autoincrement=False, nullable=False),
        sa.Column(
            "transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
        ),
        sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
        sa.Column("operation_type", sa.SmallInteger(), nullable=False),
        sa.PrimaryKeyConstraint("bill_id", "person_id", "transaction_id"),
    )
    op.create_index(
        op.f("ix_billowers_version_end_transaction_id"),
        "billowers_version",
        ["end_transaction_id"],
        unique=False,
    )
    op.create_index(
        op.f("ix_billowers_version_operation_type"),
        "billowers_version",
        ["operation_type"],
        unique=False,
    )
    op.create_index(
        op.f("ix_billowers_version_transaction_id"),
        "billowers_version",
        ["transaction_id"],
        unique=False,
    )
    op.create_table(
        "person_version",
        sa.Column("id", sa.Integer(), autoincrement=False, nullable=False),
        sa.Column(
            "project_id", sa.String(length=64), autoincrement=False, nullable=True
        ),
        sa.Column("name", sa.UnicodeText(), autoincrement=False, nullable=True),
        sa.Column("weight", sa.Float(), autoincrement=False, nullable=True),
        sa.Column("activated", sa.Boolean(), autoincrement=False, nullable=True),
        sa.Column(
            "transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
        ),
        sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
        sa.Column("operation_type", sa.SmallInteger(), nullable=False),
        sa.PrimaryKeyConstraint("id", "transaction_id"),
    )
    op.create_index(
        op.f("ix_person_version_end_transaction_id"),
        "person_version",
        ["end_transaction_id"],
        unique=False,
    )
    op.create_index(
        op.f("ix_person_version_operation_type"),
        "person_version",
        ["operation_type"],
        unique=False,
    )
    op.create_index(
        op.f("ix_person_version_transaction_id"),
        "person_version",
        ["transaction_id"],
        unique=False,
    )
    op.create_table(
        "project_version",
        sa.Column("id", sa.String(length=64), autoincrement=False, nullable=False),
        sa.Column("name", sa.UnicodeText(), autoincrement=False, nullable=True),
        sa.Column(
            "password", sa.String(length=128), autoincrement=False, nullable=True
        ),
        sa.Column(
            "contact_email", sa.String(length=128), autoincrement=False, nullable=True
        ),
        sa.Column(
            "logging_preference",
            sa.Enum("DISABLED", "ENABLED", "RECORD_IP", name="loggingmode"),
            server_default="ENABLED",
            autoincrement=False,
            nullable=True,
        ),
        sa.Column(
            "transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
        ),
        sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
        sa.Column("operation_type", sa.SmallInteger(), nullable=False),
        sa.PrimaryKeyConstraint("id", "transaction_id"),
    )
    op.create_index(
        op.f("ix_project_version_end_transaction_id"),
        "project_version",
        ["end_transaction_id"],
        unique=False,
    )
    op.create_index(
        op.f("ix_project_version_operation_type"),
        "project_version",
        ["operation_type"],
        unique=False,
    )
    op.create_index(
        op.f("ix_project_version_transaction_id"),
        "project_version",
        ["transaction_id"],
        unique=False,
    )
    op.create_table(
        "transaction",
        sa.Column("issued_at", sa.DateTime(), nullable=True),
        sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
        sa.Column("remote_addr", sa.String(length=50), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.add_column(
        "project",
        sa.Column(
            "logging_preference",
            sa.Enum("DISABLED", "ENABLED", "RECORD_IP", name="loggingmode"),
            server_default="ENABLED",
            nullable=False,
        ),
    )
Exemplo n.º 25
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('LTIProvider',
                    sa.Column('id', sa.String(length=36), nullable=False),
                    sa.Column('key', sa.Unicode(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('key'))
    op.create_table(
        'Permission', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.Unicode(), nullable=True),
        sa.Column('default_value', sa.Boolean(), nullable=True),
        sa.Column('course_permission', sa.Boolean(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_Permission_course_permission'),
                    'Permission', ['course_permission'],
                    unique=False)
    op.create_index(op.f('ix_Permission_name'),
                    'Permission', ['name'],
                    unique=True)
    op.create_table('Role', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.Unicode(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table(
        'Course', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.Unicode(), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('lti_course_id', sa.Unicode(), nullable=True),
        sa.Column('lti_provider_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(
            ['lti_provider_id'],
            ['LTIProvider.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('lti_course_id'))
    op.create_table(
        'User', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('lti_user_id', sa.Unicode(), nullable=True),
        sa.Column('name', sa.Unicode(), nullable=True),
        sa.Column('active', sa.Boolean(), nullable=True),
        sa.Column('Role_id', sa.Integer(), nullable=True),
        sa.Column('email', sa.Unicode(), nullable=True),
        sa.Column('password', sqlalchemy_utils.PasswordType, nullable=True),
        sa.ForeignKeyConstraint(
            ['Role_id'],
            ['Role.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'),
        sa.UniqueConstraint('lti_user_id'))
    op.create_table(
        'roles-permissions',
        sa.Column('permission_id', sa.Integer(), nullable=True),
        sa.Column('role_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['permission_id'], ['Permission.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['role_id'], ['Role.id'], ondelete='CASCADE'))
    op.create_table(
        'Assignment', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.Unicode(), nullable=True),
        sa.Column('state',
                  sa.Enum('hidden',
                          'open',
                          'done',
                          name='_assignmentstateenum'),
                  nullable=False),
        sa.Column('description', sa.Unicode(), nullable=True),
        sa.Column('Course_id', sa.Integer(), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('deadline', sa.DateTime(), nullable=True),
        sa.Column('lti_assignment_id', sa.Unicode(), nullable=True),
        sa.Column('lti_outcome_service_url', sa.Unicode(), nullable=True),
        sa.ForeignKeyConstraint(
            ['Course_id'],
            ['Course.id'],
        ), sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('lti_assignment_id'))
    op.create_table('Course_Role', sa.Column('id',
                                             sa.Integer(),
                                             nullable=False),
                    sa.Column('name', sa.Unicode(), nullable=True),
                    sa.Column('Course_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['Course_id'],
                        ['Course.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table('Snippet', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('key', sa.Unicode(), nullable=False),
                    sa.Column('value', sa.Unicode(), nullable=False),
                    sa.Column('User_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['User_id'],
                        ['User.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'AssignmentLinter',
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('name', sa.Unicode(), nullable=True),
        sa.Column('config', sa.Unicode(), nullable=False),
        sa.Column('Assignment_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['Assignment_id'],
            ['Assignment.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'AssignmentResult', sa.Column('sourcedid', sa.Unicode(),
                                      nullable=True),
        sa.Column('User_id', sa.Integer(), nullable=False),
        sa.Column('Assignment_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['Assignment_id'], ['Assignment.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['User_id'], ['User.id'], ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('Assignment_id', 'User_id'))
    op.create_table(
        'RubricRow', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('Assignment_id', sa.Integer(), nullable=True),
        sa.Column('header', sa.Unicode(), nullable=True),
        sa.Column('description', sa.Unicode(), nullable=True),
        sa.ForeignKeyConstraint(
            ['Assignment_id'],
            ['Assignment.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'Work', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('Assignment_id', sa.Integer(), nullable=True),
        sa.Column('User_id', sa.Integer(), nullable=True),
        sa.Column('grade', sa.Float(), nullable=True),
        sa.Column('comment', sa.Unicode(), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('assigned_to', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['Assignment_id'],
            ['Assignment.id'],
        ), sa.ForeignKeyConstraint(['User_id'], ['User.id'],
                                   ondelete='CASCADE'),
        sa.ForeignKeyConstraint(
            ['assigned_to'],
            ['User.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'course_roles-permissions',
        sa.Column('permission_id', sa.Integer(), nullable=True),
        sa.Column('course_role_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['course_role_id'], ['Course_Role.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['permission_id'], ['Permission.id'],
                                ondelete='CASCADE'))
    op.create_table(
        'users-courses', sa.Column('course_id', sa.Integer(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['course_id'], ['Course_Role.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['User.id'], ondelete='CASCADE'))
    op.create_table(
        'File', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('Work_id', sa.Integer(), nullable=True),
        sa.Column('extension', sa.Unicode(), nullable=True),
        sa.Column('name', sa.Unicode(), nullable=False),
        sa.Column('filename', sa.Unicode(), nullable=True),
        sa.Column('modification_date', sa.DateTime(), nullable=True),
        sa.Column('fileowner',
                  sa.Enum('student', 'teacher', 'both', name='fileowner'),
                  nullable=False),
        sa.Column('is_directory', sa.Boolean(), nullable=True),
        sa.Column('parent_id', sa.Integer(), nullable=True),
        sa.CheckConstraint('is_directory = false OR extension IS NULL'),
        sa.ForeignKeyConstraint(
            ['Work_id'],
            ['Work.id'],
        ), sa.ForeignKeyConstraint(
            ['parent_id'],
            ['File.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'LinterInstance', sa.Column('id', sa.String(length=36),
                                    nullable=False),
        sa.Column('state',
                  sa.Enum('running', 'done', 'crashed', name='linterstate'),
                  nullable=False),
        sa.Column('Work_id', sa.Integer(), nullable=True),
        sa.Column('tester_id', sa.Unicode(), nullable=True),
        sa.ForeignKeyConstraint(
            ['Work_id'],
            ['Work.id'],
        ), sa.ForeignKeyConstraint(
            ['tester_id'],
            ['AssignmentLinter.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'RubricItem', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('Rubricrow_id', sa.Integer(), nullable=True),
        sa.Column('description', sa.Unicode(), nullable=True),
        sa.Column('points', sa.Float(), nullable=True),
        sa.ForeignKeyConstraint(['Rubricrow_id'], ['RubricRow.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
    op.create_table('Comment',
                    sa.Column('File_id', sa.Integer(), nullable=False),
                    sa.Column('User_id', sa.Integer(), nullable=True),
                    sa.Column('line', sa.Integer(), nullable=False),
                    sa.Column('comment', sa.Unicode(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['File_id'],
                        ['File.id'],
                    ), sa.ForeignKeyConstraint(
                        ['User_id'],
                        ['User.id'],
                    ), sa.PrimaryKeyConstraint('File_id', 'line'))
    op.create_table(
        'LinterComment', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('File_id', sa.Integer(), nullable=True),
        sa.Column('linter_id', sa.Unicode(), nullable=True),
        sa.Column('line', sa.Integer(), nullable=True),
        sa.Column('linter_code', sa.Unicode(), nullable=True),
        sa.Column('comment', sa.Unicode(), nullable=True),
        sa.ForeignKeyConstraint(
            ['File_id'],
            ['File.id'],
        ), sa.ForeignKeyConstraint(
            ['linter_id'],
            ['LinterInstance.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_LinterComment_File_id'),
                    'LinterComment', ['File_id'],
                    unique=False)
    op.create_table(
        'work_rubric_item', sa.Column('work_id', sa.Integer(), nullable=True),
        sa.Column('rubricitem_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['rubricitem_id'], ['RubricItem.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['work_id'], ['Work.id'], ondelete='CASCADE'))
Exemplo n.º 26
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'assinatura', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('id_entidade', sa.Integer(), nullable=True),
        sa.Column('id_pacote_informacao', sa.Integer(), nullable=True),
        sa.Column('data_compra', sa.String(length=10), nullable=True),
        sa.Column('validade', sa.String(length=10), nullable=True),
        sa.Column('preco_compra', sa.Float(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'endereco', sa.Column('codlocal', sa.Integer(), nullable=False),
        sa.Column('local1', sa.String(length=100), nullable=True),
        sa.Column('local2', sa.String(length=100), nullable=True),
        sa.Column('complemento', sa.String(length=100), nullable=True),
        sa.Column('numero', sa.String(length=10), nullable=True),
        sa.Column('bairro', sa.String(length=20), nullable=True),
        sa.Column('latitude', sa.String(length=30), nullable=True),
        sa.Column('longitude', sa.String(length=30), nullable=True),
        sa.PrimaryKeyConstraint('codlocal'))
    op.create_table('enderecoEntidade',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('rua', sa.String(length=35), nullable=True),
                    sa.Column('bairro', sa.String(length=30), nullable=True),
                    sa.Column('cidade', sa.String(length=30), nullable=True),
                    sa.Column('estado', sa.String(length=35), nullable=True),
                    sa.Column('numero', sa.Integer(), nullable=True),
                    sa.Column('cep', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))

    op.create_table(
        'pacote_informacao', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('nome_pacote', sa.String(length=30), nullable=True),
        sa.Column('tipo_entidade', sa.Integer(), nullable=True),
        sa.Column('ano_pacote', sa.String(length=10), nullable=True),
        sa.Column('duracao', sa.String(length=10), nullable=True),
        sa.Column('descricao', sa.String(length=50), nullable=True),
        sa.Column('valor', sa.Float(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'sugestao', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('id_entidade', sa.Integer(), nullable=True),
        sa.Column('mensagem', sa.String(length=150), nullable=True),
        sa.Column('data', sa.String(length=10), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'usuario',
        sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
        sa.Column('email', sa.String(length=40), nullable=True),
        sa.Column('password', sa.String(length=16), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'))
    op.create_table(
        'acidente', sa.Column('codacidente', sa.Integer(), nullable=False),
        sa.Column('data_abertura', sa.String(length=20), nullable=True),
        sa.Column('hora_abertura', sa.String(length=20), nullable=True),
        sa.Column('tipo_ocorrencia', sa.String(length=45), nullable=True),
        sa.Column('quantidade_vitimas', sa.String(length=5), nullable=True),
        sa.Column('descricao', sa.String(length=200), nullable=True),
        sa.Column('endereco_codlocal', sa.Integer(), nullable=True),
        sa.Column('tipo', sa.String(length=45), nullable=True),
        sa.ForeignKeyConstraint(
            ['endereco_codlocal'],
            ['endereco.codlocal'],
        ), sa.PrimaryKeyConstraint('codacidente'))
    op.create_table(
        'entidade', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('cnpj', sa.String(length=14), nullable=True),
        sa.Column('estado', sa.Boolean(), nullable=True),
        sa.Column('telefone', sa.Integer(), nullable=True),
        sa.Column('tipo_entidade', sa.Integer(), nullable=True),
        sa.Column('razao_social', sa.String(length=50), nullable=True),
        sa.Column('id_endereco', sa.Integer(), nullable=True),
        sa.Column('id_usuario', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['id_endereco'],
            ['enderecoEntidade.id'],
        ), sa.ForeignKeyConstraint(
            ['id_usuario'],
            ['usuario.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('cnpj'))
    op.create_table(
        'equipamento_fiscalizacao',
        sa.Column('codequip', sa.Integer(), nullable=False),
        sa.Column('equipamento', sa.String(length=100), nullable=True),
        sa.Column('velocidade_regulamentada',
                  sa.String(length=5),
                  nullable=True),
        sa.Column('endereco_codlocal', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['endereco_codlocal'],
            ['endereco.codlocal'],
        ), sa.PrimaryKeyConstraint('codequip'))
    op.create_table(
        'registro_infracao',
        sa.Column('codregistro', sa.Integer(), nullable=False),
        sa.Column('data_infracao', sa.String(length=45), nullable=True),
        sa.Column('hora_infracao', sa.String(length=10), nullable=True),
        sa.Column('data_implantacao', sa.String(length=45), nullable=True),
        sa.Column('agente_equipamento', sa.String(length=45), nullable=True),
        sa.Column('infracao_codinfracao', sa.Integer(), nullable=True),
        sa.Column('descricaoinfracao', sa.String(length=300), nullable=True),
        sa.Column('endereco_codlocal', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['endereco_codlocal'],
            ['endereco.codlocal'],
        ), sa.PrimaryKeyConstraint('codregistro'))
    op.create_table(
        'semaforo', sa.Column('codsemaforo', sa.Integer(), nullable=False),
        sa.Column('funcionamento', sa.String(length=45), nullable=True),
        sa.Column('sinalsonoro', sa.String(length=45), nullable=True),
        sa.Column('sinalizadorciclista', sa.String(length=145), nullable=True),
        sa.Column('utilizacao', sa.String(length=45), nullable=True),
        sa.Column('endereco_codlocal', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['endereco_codlocal'],
            ['endereco.codlocal'],
        ), sa.PrimaryKeyConstraint('codsemaforo'))
Exemplo n.º 27
0
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('about_me', sa.String(length=140), nullable=True),
        sa.Column('last_seen', sa.DateTime(), nullable=True),
        sa.Column('token', sa.String(length=32), nullable=True),
        sa.Column('token_expiration', sa.DateTime(), nullable=True),
        sa.Column('last_message_read_time', sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_token'), 'user', ['token'], unique=True)
    op.create_index(op.f('ix_user_username'),
                    'user', ['username'],
                    unique=True)
    op.create_table('followers',
                    sa.Column('follower_id', sa.Integer(), nullable=True),
                    sa.Column('followed_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['followed_id'],
                        ['user.id'],
                    ), sa.ForeignKeyConstraint(
                        ['follower_id'],
                        ['user.id'],
                    ))
    op.create_table('message', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('sender_id', sa.Integer(), nullable=True),
                    sa.Column('recipient_id', sa.Integer(), nullable=True),
                    sa.Column('body', sa.String(length=140), nullable=True),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['recipient_id'],
                        ['user.id'],
                    ), sa.ForeignKeyConstraint(
                        ['sender_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_message_timestamp'),
                    'message', ['timestamp'],
                    unique=False)
    op.create_table('notification',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=128), nullable=True),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('timestamp', sa.Float(), nullable=True),
                    sa.Column('payload_json', sa.Text(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_notification_name'),
                    'notification', ['name'],
                    unique=False)
    op.create_index(op.f('ix_notification_timestamp'),
                    'notification', ['timestamp'],
                    unique=False)
    op.create_table('post', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('body', sa.String(length=140), nullable=True),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('language', sa.String(length=5), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_post_timestamp'),
                    'post', ['timestamp'],
                    unique=False)
    op.create_table(
        'task', sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('name', sa.String(length=128), nullable=True),
        sa.Column('description', sa.String(length=128), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('complete', sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_task_name'), 'task', ['name'], unique=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('country', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=128), nullable=True),
                    sa.Column('c2', sa.String(length=128), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_index(op.f('ix_country_c2'), 'country', ['c2'], unique=False)
    op.create_index(op.f('ix_country_name'), 'country', ['name'], unique=False)
    op.create_table('drug', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=128), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_index(op.f('ix_drug_name'), 'drug', ['name'], unique=False)
    op.create_table('market', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=128), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_index(op.f('ix_market_name'), 'market', ['name'], unique=False)
    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.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('listing', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('url', sa.String(length=128), nullable=True),
                    sa.Column('market_id', sa.Integer(), nullable=True),
                    sa.Column('drug_id', sa.Integer(), nullable=True),
                    sa.Column('seller', sa.String(length=128), nullable=True),
                    sa.Column('origin_id', sa.Integer(), nullable=True),
                    sa.Column('timestamp', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['drug_id'],
                        ['drug.id'],
                    ), sa.ForeignKeyConstraint(
                        ['market_id'],
                        ['market.id'],
                    ), sa.ForeignKeyConstraint(
                        ['origin_id'],
                        ['country.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_listing_seller'),
                    'listing', ['seller'],
                    unique=False)
    op.create_index(op.f('ix_listing_timestamp'),
                    'listing', ['timestamp'],
                    unique=False)
    op.create_table(
        'page', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=128), nullable=True),
        sa.Column('price', sa.Float(), nullable=True),
        sa.Column('html',
                  sa.TEXT(collation='utf8mb4_unicode_ci'),
                  nullable=True),
        sa.Column('listing_id', sa.Integer(), nullable=True),
        sa.Column('timestamp', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ['listing_id'],
            ['listing.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_page_timestamp'),
                    'page', ['timestamp'],
                    unique=False)
Exemplo n.º 29
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'clan', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('clan_name', sa.String(length=128), nullable=True),
        sa.Column('clan_avatar', sa.String(length=128), nullable=True),
        sa.Column('clan_admin', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_clan_clan_admin'),
                    'clan', ['clan_admin'],
                    unique=True)
    op.create_index(op.f('ix_clan_clan_name'),
                    'clan', ['clan_name'],
                    unique=True)
    op.create_table('region', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('ident', sa.String(length=4), nullable=True),
                    sa.Column('name', sa.String(length=64), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table('ticket', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('value', sa.String(length=1600), nullable=True),
                    sa.Column('created', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'user', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('r6_user', sa.String(length=64), nullable=True),
        sa.Column('uplay_id', 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('avatar', sa.String(length=94), nullable=True),
        sa.Column('clan_id', sa.Integer(), nullable=True),
        sa.Column('region_id', sa.Integer(), nullable=True),
        sa.Column('twitch', sa.String(length=80), nullable=True),
        sa.Column('youtube', sa.String(length=80), nullable=True),
        sa.Column('mixer', sa.String(length=80), nullable=True),
        sa.Column('last_seen', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ['clan_id'],
            ['clan.id'],
        ), sa.ForeignKeyConstraint(
            ['region_id'],
            ['region.id'],
        ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('mixer'),
        sa.UniqueConstraint('twitch'), sa.UniqueConstraint('youtube'))
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_r6_user'), 'user', ['r6_user'], unique=True)
    op.create_index(op.f('ix_user_uplay_id'),
                    'user', ['uplay_id'],
                    unique=True)
    op.create_table(
        'data', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('time_played', sa.Integer(), nullable=True),
        sa.Column('kills', sa.Integer(), nullable=True),
        sa.Column('deaths', sa.Integer(), nullable=True),
        sa.Column('wins', sa.Integer(), nullable=True),
        sa.Column('losses', sa.Integer(), nullable=True),
        sa.Column('kd_ratio',
                  sa.Float(asdecimal=True, decimal_return_scale=2),
                  nullable=True),
        sa.Column('wl_ratio',
                  sa.Float(asdecimal=True, decimal_return_scale=2),
                  nullable=True),
        sa.Column('waifu', sa.String(length=64), nullable=True),
        sa.Column('rank', sa.String(length=64), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('last_updated', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'diff', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('time_played', sa.Integer(), nullable=True),
        sa.Column('kills', sa.Integer(), nullable=True),
        sa.Column('deaths', sa.Integer(), nullable=True),
        sa.Column('wins', sa.Integer(), nullable=True),
        sa.Column('losses', sa.Integer(), nullable=True),
        sa.Column('kd_ratio',
                  sa.Float(asdecimal=True, decimal_return_scale=2),
                  nullable=True),
        sa.Column('wl_ratio',
                  sa.Float(asdecimal=True, decimal_return_scale=2),
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['user.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_table('weekly', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('user_id', sa.Integer(), nullable=True),
                    sa.Column('time_played', sa.Integer(), nullable=True),
                    sa.Column('kills', sa.Integer(), nullable=True),
                    sa.Column('deaths', sa.Integer(), nullable=True),
                    sa.Column('wins', sa.Integer(), nullable=True),
                    sa.Column('losses', sa.Integer(), nullable=True),
                    sa.Column('last_updated', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['user.id'],
                    ), sa.PrimaryKeyConstraint('id'))
Exemplo n.º 30
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('delivery', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('region', sa.Text(), nullable=False),
                    sa.Column('price', sa.Float(), nullable=False),
                    sa.PrimaryKeyConstraint('id'))