-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path41e3e1eb6c9d_remove_union_member.py
More file actions
37 lines (28 loc) · 1.27 KB
/
41e3e1eb6c9d_remove_union_member.py
File metadata and controls
37 lines (28 loc) · 1.27 KB
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
37
"""remove union_member
Revision ID: 41e3e1eb6c9d
Revises: a68c6bb2972c
Create Date: 2025-10-07 19:40:11.770337
"""
import sqlalchemy as sa
from alembic import op
revision = '41e3e1eb6c9d'
down_revision = 'a68c6bb2972c'
branch_labels = None
depends_on = None
def upgrade():
op.drop_constraint('file_owner_id_fkey', 'file', type_='foreignkey')
op.drop_constraint('print_fact_owner_id_fkey', 'print_fact', type_='foreignkey')
op.drop_table('union_member')
op.alter_column('file', 'source', existing_type=sa.VARCHAR(), nullable=False)
def downgrade():
op.alter_column('file', 'source', existing_type=sa.VARCHAR(), nullable=True)
op.create_table(
'union_member',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('surname', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('union_number', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('student_number', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='union_member_pkey'),
)
op.create_foreign_key('file_owner_id_fkey', 'file', 'union_member', ['owner_id'], ['id'])
op.create_foreign_key('print_fact_owner_id_fkey', 'print_fact', 'union_member', ['owner_id'], ['id'])