-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2023-02-16_823354eaef0b_attendance_models.py
73 lines (65 loc) · 2.08 KB
/
2023-02-16_823354eaef0b_attendance_models.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""attendance models
Revision ID: 823354eaef0b
Revises: a46d44436397
Create Date: 2023-02-16 01:54:56.208611
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "823354eaef0b"
down_revision = "a46d44436397"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"attendance_records",
sa.Column("attendance_sheet_id", sa.Integer(), nullable=False),
)
op.alter_column(
"attendance_records",
"attending_parent",
existing_type=postgresql.ENUM("MOM", "DAD", name="attending_parent"),
nullable=False,
)
op.alter_column(
"attendance_records", "comments", existing_type=sa.VARCHAR(), nullable=True
)
op.drop_constraint(
"attendance_records_attendace_sheet_id_fkey",
"attendance_records",
type_="foreignkey",
)
op.create_foreign_key(
None, "attendance_records", "attendance_sheets", ["attendance_sheet_id"], ["id"]
)
op.drop_column("attendance_records", "attendace_sheet_id")
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"attendance_records",
sa.Column(
"attendace_sheet_id", sa.INTEGER(), autoincrement=False, nullable=False
),
)
op.drop_constraint(None, "attendance_records", type_="foreignkey")
op.create_foreign_key(
"attendance_records_attendace_sheet_id_fkey",
"attendance_records",
"attendance_sheets",
["attendace_sheet_id"],
["id"],
)
op.alter_column(
"attendance_records", "comments", existing_type=sa.VARCHAR(), nullable=False
)
op.alter_column(
"attendance_records",
"attending_parent",
existing_type=postgresql.ENUM("MOM", "DAD", name="attending_parent"),
nullable=True,
)
op.drop_column("attendance_records", "attendance_sheet_id")
# ### end Alembic commands ###