58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
"""empty message
|
|
|
|
Revision ID: 411a1d0b9294
|
|
Revises: bad91e69ca34
|
|
Create Date: 2023-04-13 20:14:04.733864
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '411a1d0b9294'
|
|
down_revision = 'bad91e69ca34'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('appointment',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('patient_id', sa.Integer(), nullable=True),
|
|
sa.Column('doc_id', sa.Integer(), nullable=True),
|
|
sa.Column('date', sa.Date(), nullable=True),
|
|
sa.ForeignKeyConstraint(['doc_id'], ['users.id'], ),
|
|
sa.ForeignKeyConstraint(['patient_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('appointment', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_appointment_date'), ['date'], unique=False)
|
|
|
|
op.create_table('workday',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('doc_id', sa.Integer(), nullable=True),
|
|
sa.Column('date', sa.Date(), nullable=True),
|
|
sa.Column('num', sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(['doc_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('workday', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_workday_date'), ['date'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('workday', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_workday_date'))
|
|
|
|
op.drop_table('workday')
|
|
with op.batch_alter_table('appointment', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_appointment_date'))
|
|
|
|
op.drop_table('appointment')
|
|
# ### end Alembic commands ###
|