/
8ea58c1b7416_alter_db.py
36 lines (28 loc) · 1.21 KB
/
8ea58c1b7416_alter_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""alter db
Revision ID: 8ea58c1b7416
Revises: 5984ec75fe6f
Create Date: 2016-05-14 12:10:03.820778
"""
# revision identifiers, used by Alembic.
revision = '8ea58c1b7416'
down_revision = '5984ec75fe6f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('dismissal',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('resource_id', sa.Integer(), nullable=False),
sa.Column('date', sa.Date(), nullable=True),
sa.Column('employee_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['employee_id'], ['employee.id'], name='fk_employee_id_appointment', onupdate='cascade', ondelete='restrict'),
sa.ForeignKeyConstraint(['resource_id'], ['resource.id'], name='fk_resource_id_dismissal', onupdate='cascade', ondelete='restrict'),
sa.PrimaryKeyConstraint('id')
)
op.drop_column(u'employee', 'dismissal_date')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column(u'employee', sa.Column('dismissal_date', sa.DATE(), autoincrement=False, nullable=True))
op.drop_table('dismissal')
### end Alembic commands ###