def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'timetable',
        sa.Column('timetable_id',
                  sa.BIGINT(),
                  autoincrement=True,
                  nullable=False),
        sa.Column('week_day',
                  postgresql.ENUM('Понедельник',
                                  'Вторник',
                                  'Среда',
                                  'Четверг',
                                  'Пятница',
                                  'Суббота',
                                  'Воскресенье',
                                  name='enum'),
                  autoincrement=False,
                  nullable=True),
        sa.Column('time_from',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('time_to',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('timetable_id', name='timetable_pkey'))
Exemple #2
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('line',
                  sa.Column('closing_time', postgresql.TIME(), nullable=True),
                  schema='navitia')
    op.add_column('line',
                  sa.Column('opening_time', postgresql.TIME(), nullable=True),
                  schema='navitia')
Exemple #3
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'Artist',
        sa.Column('artist_date_begin',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'Artist',
        sa.Column('artist_date_end',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'artist_available_times',
        sa.Column('available_time_to',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=False))
    op.add_column(
        'artist_available_times',
        sa.Column('available_time_from',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=False))
    op.drop_column('artist_available_times', 'time_to')
    op.drop_column('artist_available_times', 'time_from')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users',
                    'reminder_time',
                    existing_type=sa.String(),
                    type_=postgresql.TIME(),
                    existing_nullable=True)
Exemple #6
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'album',
        sa.Column('duration',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=False))
Exemple #7
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('venue', 'seeking_talent')
    op.drop_column('venue', 'seeking_description')
    op.add_column('show', sa.Column('time', postgresql.TIME(), autoincrement=False, nullable=False))
    op.drop_column('artist', 'website')
    op.drop_column('artist', 'seeking_venue')
    op.drop_column('artist', 'seeking_description')
Exemple #8
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'historico',
        sa.Column('hora',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True))
    op.drop_column('historico', 'data_pesquisa')
Exemple #9
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('movie', sa.Column('close_date', sa.Date(), nullable=True))
    op.drop_column('movie', 'availability')
    op.alter_column('seance', 'date', existing_type=sa.DATE(), nullable=False)
    op.alter_column('seance',
                    'time',
                    existing_type=postgresql.TIME(),
                    nullable=False)
Exemple #10
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'activity',
        sa.Column('time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=False))
    op.drop_column('activity', 'lapse')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('labs',
                    'recvTime',
                    existing_type=postgresql.TIME(),
                    nullable=True)
    op.alter_column('labs', 'recvDate', existing_type=sa.DATE(), nullable=True)
    op.drop_column('labs', 'reportTime')
    op.drop_column('labs', 'reportDate')
Exemple #12
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'results',
        sa.Column('time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'messages',
        sa.Column('time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True))
    op.add_column(
        'messages',
        sa.Column('date', sa.DATE(), autoincrement=False, nullable=True))
    op.drop_column('messages', 'datetime')
Exemple #13
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('request',
                    'table_number',
                    existing_type=sa.TEXT(),
                    nullable=False)
    op.alter_column('request',
                    'time',
                    existing_type=postgresql.TIME(),
                    nullable=False)
    op.create_unique_constraint(None, 'request', ['table_number'])
Exemple #14
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'request', type_='unique')
    op.alter_column('request',
                    'time',
                    existing_type=postgresql.TIME(),
                    nullable=True)
    op.alter_column('request',
                    'table_number',
                    existing_type=sa.TEXT(),
                    nullable=True)
Exemple #15
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('Show', sa.Column('time', postgresql.TIME(), autoincrement=False, nullable=False))
    op.add_column('Show', sa.Column('date', sa.DATE(), autoincrement=False, nullable=False))
    op.alter_column('Show', 'day',
               existing_type=sa.VARCHAR(length=10),
               nullable=False)
    op.alter_column('Show', 'am',
               existing_type=sa.BOOLEAN(),
               nullable=False)
    op.drop_column('Show', 'start_time')
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('labs', sa.Column('reportDate', sa.Date(), nullable=True))
    op.add_column('labs', sa.Column('reportTime', sa.Time(), nullable=True))
    op.alter_column('labs',
                    'recvDate',
                    existing_type=sa.DATE(),
                    nullable=False)
    op.alter_column('labs',
                    'recvTime',
                    existing_type=postgresql.TIME(),
                    nullable=False)
Exemple #17
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users',
                    'username',
                    existing_type=sa.VARCHAR(length=250),
                    nullable=True)
    op.alter_column('users',
                    'password',
                    existing_type=sa.VARCHAR(length=250),
                    nullable=True)
    op.alter_column('users',
                    'last_name',
                    existing_type=sa.VARCHAR(length=250),
                    nullable=True)
    op.alter_column('users',
                    'first_name',
                    existing_type=sa.VARCHAR(length=150),
                    nullable=True)
    op.alter_column('users',
                    'email',
                    existing_type=sa.VARCHAR(length=100),
                    nullable=True)
    op.alter_column('events',
                    'user_id',
                    existing_type=sa.INTEGER(),
                    nullable=True)
    op.alter_column('events',
                    'start_time',
                    existing_type=postgresql.TIME(),
                    nullable=True)
    op.alter_column('events',
                    'name',
                    existing_type=sa.VARCHAR(length=255),
                    nullable=True)
    op.alter_column('events',
                    'end_time',
                    existing_type=postgresql.TIME(),
                    nullable=True)
    op.alter_column('events', 'day', existing_type=sa.DATE(), nullable=True)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'tables',
        sa.Column('number', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column(
        'booking',
        sa.Column('period', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column(
        'booking',
        sa.Column('time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True))
    op.drop_column('booking', 'time_to')
    op.drop_column('booking', 'time_from')
Exemple #19
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'securities', sa.Column('securityid', sa.Integer(), nullable=False),
        sa.Column('securitytype', sa.String(length=30), nullable=True),
        sa.Column('securityname', sa.String(length=30), nullable=True),
        sa.Column('initialprice', sa.Float(), nullable=True),
        sa.Column('currentprice', sa.Float(), nullable=True),
        sa.PrimaryKeyConstraint('securityid'))
    op.alter_column('trades',
                    'brokername',
                    existing_type=sa.VARCHAR(length=10),
                    nullable=True)
    op.alter_column('trades', 'price', existing_type=sa.REAL(), nullable=True)
    op.alter_column('trades',
                    'quantity',
                    existing_type=sa.INTEGER(),
                    nullable=True)
    op.alter_column('trades',
                    'security',
                    existing_type=sa.VARCHAR(length=15),
                    nullable=True)
    op.alter_column('trades',
                    'securitytype',
                    existing_type=sa.VARCHAR(length=15),
                    nullable=True)
    op.alter_column('trades',
                    'tradeby',
                    existing_type=sa.VARCHAR(length=10),
                    nullable=True)
    op.alter_column('trades',
                    'tradedate',
                    existing_type=sa.DATE(),
                    nullable=True)
    op.alter_column('trades',
                    'tradetime',
                    existing_type=postgresql.TIME(),
                    nullable=True)
    op.alter_column('trades',
                    'tradetype',
                    existing_type=sa.VARCHAR(length=5),
                    nullable=True)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'pitch',
        sa.Column('owner_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False))
    op.drop_constraint(None, 'pitch', type_='foreignkey')
    op.create_foreign_key('pitch_owner_id_fkey', 'pitch', 'users',
                          ['owner_id'], ['id'])
    op.drop_column('pitch', 'user_id')
    op.create_table(
        'reviews',
        sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
        sa.Column('movie_id', sa.INTEGER(), autoincrement=False,
                  nullable=True),
        sa.Column('movie_title',
                  sa.VARCHAR(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('image_path',
                  sa.VARCHAR(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('movie_review',
                  sa.VARCHAR(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('posted',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'],
                                name='reviews_user_id_fkey'),
        sa.PrimaryKeyConstraint('id', name='reviews_pkey'))
Exemple #21
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'ventas',
        sa.Column('idproducto',
                  sa.INTEGER(),
                  autoincrement=True,
                  nullable=False),
        sa.Column('descripcion',
                  sa.VARCHAR(length=100),
                  autoincrement=False,
                  nullable=True),
        sa.Column('precio', sa.REAL(), autoincrement=False, nullable=True),
        sa.Column('cantidad',
                  sa.SMALLINT(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('fechaventa',
                  postgresql.TIME(precision=0),
                  autoincrement=False,
                  nullable=True))
    op.create_table(
        'inventario',
        sa.Column('idproducto',
                  sa.INTEGER(),
                  autoincrement=True,
                  nullable=False),
        sa.Column('producto',
                  sa.VARCHAR(length=50),
                  autoincrement=False,
                  nullable=True),
        sa.Column('precio', sa.REAL(), autoincrement=False, nullable=True),
        sa.Column('cantidad',
                  sa.SMALLINT(),
                  autoincrement=False,
                  nullable=True))
    op.drop_table('cars')
Exemple #22
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('trades',
                    'tradetype',
                    existing_type=sa.VARCHAR(length=5),
                    nullable=False)
    op.alter_column('trades',
                    'tradetime',
                    existing_type=postgresql.TIME(),
                    nullable=False)
    op.alter_column('trades',
                    'tradedate',
                    existing_type=sa.DATE(),
                    nullable=False)
    op.alter_column('trades',
                    'tradeby',
                    existing_type=sa.VARCHAR(length=10),
                    nullable=False)
    op.alter_column('trades',
                    'securitytype',
                    existing_type=sa.VARCHAR(length=15),
                    nullable=False)
    op.alter_column('trades',
                    'security',
                    existing_type=sa.VARCHAR(length=15),
                    nullable=False)
    op.alter_column('trades',
                    'quantity',
                    existing_type=sa.INTEGER(),
                    nullable=False)
    op.alter_column('trades', 'price', existing_type=sa.REAL(), nullable=False)
    op.alter_column('trades',
                    'brokername',
                    existing_type=sa.VARCHAR(length=10),
                    nullable=False)
    op.drop_table('securities')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('related_persons',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('connection', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_1', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_2', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('city', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('state', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('zip_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('agency_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('agency_sub_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('officer_id', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='related_persons_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='related_persons_pkey')
    )
    op.create_table('defendants',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('defendants_id_seq'::regclass)"), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('defendant_name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('race', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('sex', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('height', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('weight', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('DOB', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('DOB_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_1', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_2', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('city', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('state', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('zip_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='defendants_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='defendants_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('dscivil_trial',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('time', postgresql.TIME(), autoincrement=False, nullable=True),
    sa.Column('time_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('room', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('location', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('duration', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='dscivil_trial_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='dscivil_trial_pkey')
    )
    op.create_table('dscr_court_schedule',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('trial_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('trial_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('trial_time', postgresql.TIME(), autoincrement=False, nullable=True),
    sa.Column('trial_time_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('room', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('trial_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('trial_location', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='dscr_court_schedule_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='court_schedule_pkey')
    )
    op.create_table('bail_and_bond',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('bail_and_bond_id_seq'::regclass)"), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('bail_amount', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('bail_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('set_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('set_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('bail_set_location', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('bond_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('bondsman_company_name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('release_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('release_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('release_reason', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('forfeit_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('forfeit_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('forfeit_extended_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('forfeit_extended_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('days_extended', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('ground_rent', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('property_address', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('property_value', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('judgment_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('judgment_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('mortgage', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='bail_and_bond_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='bail_and_bond_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('dscivil_related_person',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('connection_to_complaint', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_1', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_2', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('city', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('state', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('zip_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('attorney_code', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('attorney_firm', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='dscivil_related_person_case_number_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['complaint_id'], ['complaints.id'], name='dscivil_related_person_complaint_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='dscivil_related_person_pkey')
    )
    op.create_table('bondsman',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('bail_and_bond_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_1', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('city', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('state', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('zip_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['bail_and_bond_id'], ['bail_and_bond.id'], name='bondsman_bail_and_bond_id_fkey'),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='bondsman_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='bondsman_pkey')
    )
    op.create_table('DSCR',
    sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'"DSCR_id_seq"\'::regclass)'), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('court_system', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('tracking_number', sa.BIGINT(), autoincrement=False, nullable=True),
    sa.Column('case_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('district_code', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('location_code', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('document_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('issued_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('issued_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('case_status', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('case_disposition', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='DSCR_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='DSCR_pkey')
    )
    op.create_table('case_events',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('event_name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('comment', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='case_events_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='case_events_pkey')
    )
    op.create_table('judgments',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('judgment_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('judgment_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('judgment_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('judgment_amount', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('judgment_interest', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('costs', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('other_amounts', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('attorney_fees', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('post_interest_legal_rate', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('post_interest_contractual_rate', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('jointly_and_severally', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('in_favor_of_defendant', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('possession_value', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('possession_damages_value', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('value_sued_for', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('damages', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('dismissed_with_prejudice', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('replevin_detinue', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('recorded_lien_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('recorded_lien_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('judgment_renewed_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('renewed_lien_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('renewed_lien_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('satisfaction_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('satisfaction_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='judgments_case_number_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['complaint_id'], ['complaints.id'], name='judgments_complaint_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='judgments_pkey')
    )
    op.create_table('complaints',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('complaints_id_seq'::regclass)"), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_number', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('plaintiff', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('defendant', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_status', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('status_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('status_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('filing_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('filing_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('amount', sa.NUMERIC(), autoincrement=False, nullable=True),
    sa.Column('last_activity_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('last_activity_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='complaints_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='complaints_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('dscivil_case_history',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('event_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_number', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('comment', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='dscivil_case_history_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='dscivil_case_history_pkey')
    )
    op.create_table('DSCIVIL',
    sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'"DSCIVIL_id_seq"\'::regclass)'), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('court_system', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('claim_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('district_code', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('location_code', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('filing_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('filing_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('case_status', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='DSCIVIL_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='DSCIVIL_pkey')
    )
    op.create_table('dsk8_court_schedule',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('court_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('court_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('court_time', postgresql.TIME(), autoincrement=False, nullable=True),
    sa.Column('court_time_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('room', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('court_location', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('reason', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='dsk8_court_schedule_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='dsk8_court_schedule_pkey')
    )
    op.create_table('hearings',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('complaint_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('time', postgresql.TIME(), autoincrement=False, nullable=True),
    sa.Column('time_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('room', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('location', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('duration', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('hearing_type', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='hearings_case_number_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['complaint_id'], ['complaints.id'], name='hearings_complaint_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='hearings_pkey')
    )
    op.create_table('defendant_alias',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('defendant_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('alias_name', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_1', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('address_2', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('city', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('state', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('zip_code', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='defendant_alias_case_number_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['defendant_id'], ['defendants.id'], name='defendant_alias_defendant_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='defendant_alias_pkey')
    )
    op.create_table('DSK8',
    sa.Column('id', sa.INTEGER(), server_default=sa.text('nextval(\'"DKS8_id_seq"\'::regclass)'), nullable=False),
    sa.Column('case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('court_system', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('case_status', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('status_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('status_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('tracking_number', sa.BIGINT(), autoincrement=False, nullable=True),
    sa.Column('complaint_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('district_case_number', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('filing_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('filing_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('incident_date', sa.DATE(), autoincrement=False, nullable=True),
    sa.Column('incident_date_str', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['case_number'], ['cases.case_number'], name='DKS8_case_number_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='DKS8_pkey')
    )
    op.drop_table('dsk8_bondsman')
    op.drop_table('dscivil_related_persons')
    op.drop_table('dscivil_judgments')
    op.drop_table('dscivil_hearings')
    op.drop_table('dsk8_trials')
    op.drop_table('dsk8_related_persons')
    op.drop_table('dsk8_events')
    op.drop_table('dsk8_defendants')
    op.drop_table('dsk8_defendant_aliases')
    op.drop_table('dsk8_charges')
    op.drop_table('dsk8_bail_and_bond')
    op.drop_table('dscr_trials')
    op.drop_table('dscr_related_persons')
    op.drop_table('dscr_events')
    op.drop_table('dscr_defendants')
    op.drop_table('dscr_defendant_aliases')
    op.drop_table('dscr_charges')
    op.drop_table('dscivil_trials')
    op.drop_table('dscivil_events')
    op.drop_table('dscivil_complaints')
    op.drop_table('dsk8')
    op.drop_table('dscr')
    op.drop_table('dscivil')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('diet',
                    sa.Column('id_diet',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('diet_name',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id_diet', name='diet_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table('resident',
                    sa.Column('id_resident',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('gender',
                              sa.VARCHAR(length=8),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('surname',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('name',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('patronymic',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('room_number',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('birthday',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('place_number',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('start_day',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('final_day',
                              sa.DATE(),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(['place_number'],
                                            ['canteen_place.canteen_number'],
                                            name='place_number'),
                    sa.ForeignKeyConstraint(['room_number'],
                                            ['living_room.room_number'],
                                            name='resident_room_number_fkey'),
                    sa.PrimaryKeyConstraint('id_resident',
                                            name='resident_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table(
        'appointment',
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('id_procedure',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['id_procedure'],
                                ['medical_procedure.id_procedure'],
                                name='appointment_id_procedure_fkey'),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='appointment_id_resident_fkey'))
    op.create_table('infrastructure',
                    sa.Column('rent_number',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('description',
                              sa.VARCHAR(),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('rent_number',
                                            name='infrastructure_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table('item',
                    sa.Column('id_item',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('item_name',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id_item', name='item_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table(
        'income',
        sa.Column('operation_number',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('operation_time',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('sum',
                  postgresql.MONEY(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='id_resident'),
        sa.PrimaryKeyConstraint('operation_number', name='income_pkey'))
    op.create_table('living_room',
                    sa.Column('room_number',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('floor',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('room_class',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('room_number',
                                            name='living_room_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table(
        'warehouse',
        sa.Column('id_warehouse',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('number', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('id_item', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['id_item'], ['item.id_item'],
                                name='warehouse_id_item_fkey'),
        sa.PrimaryKeyConstraint('id_warehouse', name='warehouse_pkey'))
    op.create_table(
        'consultation',
        sa.Column('id_consultation',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('consultation_name',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='consultation_id_resident_fkey'),
        sa.PrimaryKeyConstraint('id_consultation', name='consultation_pkey'))
    op.create_table('sport_group',
                    sa.Column('id_group',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('group_name',
                              sa.VARCHAR(length=40),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id_group',
                                            name='sport_group_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table('canteen_place',
                    sa.Column('canteen_number',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('id_diet',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=True),
                    sa.ForeignKeyConstraint(['id_diet'], ['diet.id_diet'],
                                            name='canteen_place_id_diet_fkey'),
                    sa.PrimaryKeyConstraint('canteen_number',
                                            name='canteen_place_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table(
        'medical_procedure',
        sa.Column('id_procedure',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=False),
        sa.Column('procedure_name',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id_procedure', name='medical_procedure_pkey'))
    op.create_table(
        'timetable',
        sa.Column('week_day',
                  sa.VARCHAR(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('start_time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('finish_time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('staff_cadr',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['staff_cadr'], ['staff.staff_cadr'],
                                name='staff_cadr'),
        sa.PrimaryKeyConstraint('week_day', name='timetable_pkey'))
    op.create_table(
        'place_rent',
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('rent_number',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='id_resident'),
        sa.ForeignKeyConstraint(['rent_number'],
                                ['infrastructure.rent_number'],
                                name='rent_number'))
    op.create_table(
        'staff',
        sa.Column('staff_cadr',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('surname',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('name',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('patronymic',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('position',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('hours', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('salary',
                  postgresql.MONEY(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('staff_cadr', name='staff_pkey'))
    op.create_table(
        'sport_membership',
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('id_group', sa.INTEGER(), autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['id_group'], ['sport_group.id_group'],
                                name='sport_membership_id_group_fkey'),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='sport_membership_id_resident_fkey'))
    op.create_table(
        'parking',
        sa.Column('id_place',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('car_number',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['car_number'], ['car.car_number'],
                                name='parking_car_number_fkey'),
        sa.PrimaryKeyConstraint('id_place', name='parking_pkey'))
    op.create_table(
        'expenses',
        sa.Column('operation_num',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('operation_data',
                  sa.DATE(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('operation_sum',
                  postgresql.MONEY(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('description',
                  sa.VARCHAR(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('operation_num', name='expenses_pkey'))
    op.create_table(
        'car',
        sa.Column('car_number',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=False),
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('model',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.Column('color',
                  sa.VARCHAR(length=40),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='car_id_resident_fkey'),
        sa.PrimaryKeyConstraint('car_number', name='car_pkey'))
    op.create_table(
        'item_rent',
        sa.Column('id_resident',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('id_item', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['id_item'], ['item.id_item'],
                                name='item_rent_id_item_fkey'),
        sa.ForeignKeyConstraint(['id_resident'], ['resident.id_resident'],
                                name='item_rent_id_resident_fkey'))
Exemple #25
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('Shows',
                    'date',
                    existing_type=postgresql.TIME(),
                    nullable=True)
Exemple #26
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'admin_settings',
        sa.Column('semester', sa.VARCHAR(length=255), nullable=False),
        sa.PrimaryKeyConstraint('semester'))
    op.create_table(
        'course', sa.Column('crn', sa.VARCHAR(length=255), nullable=False),
        sa.Column('section', sa.VARCHAR(length=255), nullable=True),
        sa.Column('semester', sa.VARCHAR(length=255), nullable=True),
        sa.Column('min_credits', sa.INTEGER(), nullable=True),
        sa.Column('max_credits', sa.INTEGER(), nullable=True),
        sa.Column('date_start', sa.DATE(), nullable=True),
        sa.Column('date_end', sa.DATE(), nullable=True),
        sa.Column('department', sa.VARCHAR(length=255), nullable=True),
        sa.Column('level', sa.INTEGER(), nullable=True),
        sa.Column('title', sa.VARCHAR(length=255), nullable=True),
        sa.Column('full_title', sa.TEXT(), nullable=True),
        sa.Column('description', sa.TEXT(), nullable=True),
        sa.Column('raw_precoreqs', sa.TEXT(), nullable=True),
        sa.Column('frequency', sa.VARCHAR(length=255), nullable=True),
        sa.Column('school', sa.VARCHAR(length=255), nullable=True),
        sa.Column('tsv', postgresql.TSVECTOR(), nullable=True),
        sa.PrimaryKeyConstraint('crn'))
    op.create_table(
        'course_corequisite',
        sa.Column('department', sa.VARCHAR(length=255), nullable=False),
        sa.Column('level', sa.INTEGER(), nullable=False),
        sa.Column('corequisite', sa.VARCHAR(length=255), nullable=False),
        sa.PrimaryKeyConstraint('department', 'level', 'corequisite'))
    op.create_table(
        'course_prerequisite',
        sa.Column('department', sa.VARCHAR(length=255), nullable=False),
        sa.Column('level', sa.INTEGER(), nullable=False),
        sa.Column('prerequisite', sa.VARCHAR(length=255), nullable=False),
        sa.PrimaryKeyConstraint('department', 'level', 'prerequisite'))
    op.create_table(
        'course_session',
        sa.Column('crn', sa.VARCHAR(length=255), nullable=False),
        sa.Column('section', sa.VARCHAR(length=255), nullable=False),
        sa.Column('semester', sa.VARCHAR(length=255), nullable=False),
        sa.Column('time_start', postgresql.TIME(), nullable=True),
        sa.Column('time_end', postgresql.TIME(), nullable=True),
        sa.Column('day_of_week', sa.INTEGER(), nullable=False),
        sa.Column('location', sa.VARCHAR(length=255), nullable=True),
        sa.PrimaryKeyConstraint('crn', 'section', 'semester', 'day_of_week'))
    op.create_table(
        'event', sa.Column('event_id', sa.INTEGER(), nullable=False),
        sa.Column('description', sa.VARCHAR(length=255), nullable=True),
        sa.PrimaryKeyConstraint('event_id'))
    op.create_table(
        'semester_date_range',
        sa.Column('semester_part_name', sa.VARCHAR(length=255), nullable=True),
        sa.Column('date_start', sa.DATE(), nullable=False),
        sa.Column('date_end', sa.DATE(), nullable=False),
        sa.PrimaryKeyConstraint('date_start', 'date_end'))
    op.create_table(
        'semester_info',
        sa.Column('semester', sa.VARCHAR(length=255), nullable=False),
        sa.Column('public', sa.BOOLEAN(), nullable=True),
        sa.PrimaryKeyConstraint('semester'))
    op.create_table('user_account',
                    sa.Column('user_id', sa.INTEGER(), nullable=False),
                    sa.Column('name', sa.TEXT(), nullable=True),
                    sa.Column('email', sa.TEXT(), nullable=False),
                    sa.Column('phone', sa.TEXT(), nullable=True),
                    sa.Column('password', sa.TEXT(), nullable=True),
                    sa.Column('major', sa.TEXT(), nullable=True),
                    sa.Column('degree', sa.TEXT(), nullable=True),
                    sa.Column('enable', sa.BOOLEAN(), nullable=True),
                    sa.Column('admin', sa.BOOLEAN(), nullable=True),
                    sa.Column('super_admin', sa.BOOLEAN(), nullable=True),
                    sa.PrimaryKeyConstraint('user_id'),
                    sa.UniqueConstraint('email'))
    op.create_table(
        'user_event', sa.Column('event_id', sa.INTEGER(), nullable=False),
        sa.Column('user_id', postgresql.UUID(), nullable=False),
        sa.Column('content', sa.VARCHAR(length=255), nullable=True),
        sa.Column('created_at', sa.BIGINT(), nullable=True),
        sa.PrimaryKeyConstraint('event_id', 'user_id'))
    op.create_table(
        'user_session',
        sa.Column('session_id', postgresql.UUID(), nullable=False),
        sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('start_time',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True),
        sa.Column('end_time',
                  postgresql.TIMESTAMP(timezone=True),
                  nullable=True), sa.PrimaryKeyConstraint('session_id'))
    op.create_table(
        'student_course_selection',
        sa.Column('user_id', sa.INTEGER(), nullable=False),
        sa.Column('semester', sa.VARCHAR(length=255), nullable=False),
        sa.Column('course_name', sa.VARCHAR(length=255), nullable=False),
        sa.Column('crn', sa.VARCHAR(length=255), nullable=False),
        sa.ForeignKeyConstraint(
            ['user_id'],
            ['user_account.user_id'],
        ), sa.PrimaryKeyConstraint('user_id', 'semester', 'course_name',
                                   'crn'))
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'date_details', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date', sa.Date(), nullable=True),
        sa.Column('type',
                  sa.Enum('required',
                          'not_required',
                          'not_important',
                          name='date_type'),
                  nullable=True), sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_date_details_date'),
                    'date_details', ['date'],
                    unique=True)
    op.create_table('madors', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name'))
    op.create_table('permissions', sa.Column('id',
                                             sa.Integer(),
                                             nullable=False),
                    sa.Column('type', sa.String(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.create_table('reasons', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(), nullable=True),
                    sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.create_table(
        'settings', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('key', sa.String(), nullable=True),
        sa.Column('value', sa.String(), nullable=True),
        sa.Column('type',
                  sa.Enum('int', 'str', 'bool', 'time', 'date', name='types'),
                  nullable=False), sa.PrimaryKeyConstraint('id'))
    op.create_table(
        'mador_settings', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('mador_name', sa.String(), nullable=True),
        sa.Column('key', sa.String(), nullable=True),
        sa.Column('value', sa.String(), nullable=True),
        sa.Column('type',
                  sa.Enum('int', 'str', 'bool', 'time', 'date', name='types'),
                  nullable=False),
        sa.ForeignKeyConstraint(['mador_name'], ['madors.name'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'))
    op.create_index(op.f('ix_mador_settings_mador_name'),
                    'mador_settings', ['mador_name'],
                    unique=False)
    op.create_table(
        'users', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('icon_path', sa.String(), nullable=True),
        sa.Column('commander_id', sa.Integer(), nullable=True),
        sa.Column('reminder_time', postgresql.TIME(), nullable=True),
        sa.Column('last_reminded_date', sa.Date(), nullable=True),
        sa.Column('english_name', sa.String(), nullable=True),
        sa.Column('type',
                  sa.Enum('facebook', 'google', 'local', name='user_type'),
                  nullable=True),
        sa.Column('username', sa.String(), nullable=True),
        sa.Column('password', sa.String(), nullable=True),
        sa.Column('mador_name', sa.String(), nullable=True),
        sa.Column('manages_mador_name', sa.String(), nullable=True),
        sa.ForeignKeyConstraint(['commander_id'], ['users.id'],
                                ondelete='SET NULL'),
        sa.ForeignKeyConstraint(['mador_name'], ['madors.name'],
                                ondelete='SET NULL'),
        sa.ForeignKeyConstraint(['manages_mador_name'], ['madors.name'],
                                ondelete='SET NULL'),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'),
        sa.UniqueConstraint('manages_mador_name'))
    op.create_index(op.f('ix_users_commander_id'),
                    'users', ['commander_id'],
                    unique=False)
    op.create_index(op.f('ix_users_mador_name'),
                    'users', ['mador_name'],
                    unique=False)
    op.create_index(op.f('ix_users_username'),
                    'users', ['username'],
                    unique=True)
    op.create_table(
        'date_datas', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('date', sa.Date(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('state',
                  sa.Enum('here', 'not_here', name='answer_state'),
                  nullable=True),
        sa.Column('reason_id', sa.Integer(), nullable=True),
        sa.Column('reported_by_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['date'], ['date_details.date'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(
            ['reason_id'],
            ['reasons.id'],
        ),
        sa.ForeignKeyConstraint(['reported_by_id'], ['users.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.create_index(op.f('ix_date_datas_date'),
                    'date_datas', ['date'],
                    unique=False)
    op.create_index(op.f('ix_date_datas_reason_id'),
                    'date_datas', ['reason_id'],
                    unique=False)
    op.create_index(op.f('ix_date_datas_reported_by_id'),
                    'date_datas', ['reported_by_id'],
                    unique=False)
    op.create_index(op.f('ix_date_datas_user_id'),
                    'date_datas', ['user_id'],
                    unique=False)
    op.create_table(
        'operators_map', sa.Column('mador_id', sa.Integer(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['mador_id'], ['madors.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'))
    op.create_index(op.f('ix_operators_map_mador_id'),
                    'operators_map', ['mador_id'],
                    unique=False)
    op.create_index(op.f('ix_operators_map_user_id'),
                    'operators_map', ['user_id'],
                    unique=False)
    op.create_table(
        'permissions_map',
        sa.Column('permission_id', sa.Integer(), nullable=True),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['permission_id'], ['permissions.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'))
    op.create_index(op.f('ix_permissions_map_permission_id'),
                    'permissions_map', ['permission_id'],
                    unique=False)
    op.create_index(op.f('ix_permissions_map_user_id'),
                    'permissions_map', ['user_id'],
                    unique=False)
    op.create_table(
        'repetative_datas', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('from_date_id', sa.Integer(), nullable=True),
        sa.Column('to_date_id', sa.Integer(), nullable=True),
        sa.Column('every', sa.Integer(), nullable=True),
        sa.Column('reason_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(['from_date_id'], ['date_details.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(
            ['reason_id'],
            ['reasons.id'],
        ),
        sa.ForeignKeyConstraint(['to_date_id'], ['date_details.id'],
                                ondelete='CASCADE'),
        sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id'))
    op.create_index(op.f('ix_repetative_datas_from_date_id'),
                    'repetative_datas', ['from_date_id'],
                    unique=False)
    op.create_index(op.f('ix_repetative_datas_reason_id'),
                    'repetative_datas', ['reason_id'],
                    unique=False)
    op.create_index(op.f('ix_repetative_datas_to_date_id'),
                    'repetative_datas', ['to_date_id'],
                    unique=False)
    op.create_index(op.f('ix_repetative_datas_user_id'),
                    'repetative_datas', ['user_id'],
                    unique=False)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('booking', sa.Column('date_to', sa.DATE(), autoincrement=False, nullable=True))
    op.add_column('booking', sa.Column('time_from', postgresql.TIME(), autoincrement=False, nullable=True))
    op.add_column('booking', sa.Column('date', sa.DATE(), autoincrement=False, nullable=True))
    op.add_column('booking', sa.Column('time_to', postgresql.TIME(), autoincrement=False, nullable=True))
Exemple #29
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'corequisite',
        sa.Column('main_subject',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=False),
        sa.Column('main_num',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('main_type',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=False),
        sa.Column('sup_subject',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=False),
        sa.Column('sup_num', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('sup_type',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(['main_subject', 'main_num'],
                                ['class.subject', 'class.num'],
                                name='corequisite_main_subject_main_num_fkey'),
        sa.ForeignKeyConstraint(['sup_subject', 'sup_num'],
                                ['class.subject', 'class.num'],
                                name='corequisite_sup_subject_sup_num_fkey'),
        sa.PrimaryKeyConstraint('sup_subject',
                                'sup_num',
                                'sup_type',
                                name='_sup_uc'))
    op.create_table(
        'courseoff',
        sa.Column('subject',
                  sa.VARCHAR(length=256),
                  autoincrement=False,
                  nullable=False),
        sa.Column('course_num',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('type',
                  sa.VARCHAR(length=8),
                  autoincrement=False,
                  nullable=False),
        sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('mon', sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.Column('tues', sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.Column('wed', sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.Column('thur', sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.Column('fri', sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.Column('start_time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('end_time',
                  postgresql.TIME(),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(['subject', 'course_num'],
                                ['class.subject', 'class.num'],
                                name='courseoff_subject_course_num_fkey'),
        sa.PrimaryKeyConstraint('subject',
                                'course_num',
                                'type',
                                'id',
                                name='courseoff_pkey'),
        postgresql_ignore_search_path=False)
    op.create_table('class',
                    sa.Column('subject',
                              sa.VARCHAR(length=32),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('num',
                              sa.INTEGER(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('unit',
                              sa.REAL(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('alp',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('cz',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('ns',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('qs',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('ss',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('cci',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('ei',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('sts',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('fl',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('r',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('w',
                              sa.BOOLEAN(),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('rating',
                              sa.REAL(),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('desc',
                              sa.VARCHAR(length=256),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('subject',
                                            'num',
                                            name='class_pkey'),
                    postgresql_ignore_search_path=False)
    op.create_table(
        'professordos',
        sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
        sa.Column('name',
                  sa.VARCHAR(length=256),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='professordos_pkey'))
    op.create_table(
        'courseprof',
        sa.Column('subject',
                  sa.VARCHAR(length=256),
                  autoincrement=False,
                  nullable=False),
        sa.Column('course_num',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('type',
                  sa.VARCHAR(length=8),
                  autoincrement=False,
                  nullable=False),
        sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column('prof_id', sa.INTEGER(), autoincrement=False,
                  nullable=False),
        sa.Column('rating', sa.REAL(), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['prof_id'], ['professor.id'],
                                name='courseprof_prof_id_fkey'),
        sa.ForeignKeyConstraint(
            ['subject', 'course_num', 'type', 'id'], [
                'courseoff.subject', 'courseoff.course_num', 'courseoff.type',
                'courseoff.id'
            ],
            name='courseprof_subject_course_num_type_id_fkey'),
        sa.PrimaryKeyConstraint('subject',
                                'course_num',
                                'type',
                                'id',
                                'prof_id',
                                name='courseprof_pkey'))
    op.create_table(
        'professor',
        sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
        sa.Column('name',
                  sa.VARCHAR(length=256),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='professor_pkey'))
    op.drop_table('courseprofdos')
    op.drop_table('courseoffdos')
    op.drop_table('corequisitedos')
    op.drop_table('classdos')
    op.drop_table('professortres')
    op.drop_table('departmentdos')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('visit', sa.Column('time_of_visit', postgresql.TIME(), autoincrement=False, nullable=False))