-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2023-10-03_9102ff64a1fd_update_attendance_sheet_fields.py
77 lines (69 loc) · 2.03 KB
/
2023-10-03_9102ff64a1fd_update_attendance_sheet_fields.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
74
75
76
77
"""Update attendance sheet fields
Revision ID: 9102ff64a1fd
Revises: ba551533e51d
Create Date: 2023-10-03 02:36:39.066166
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "9102ff64a1fd"
down_revision = "ba551533e51d"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"attendance_child",
sa.Column("attendance_sheets_id", sa.Integer(), nullable=True),
sa.Column("child_id", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
["attendance_sheets_id"],
["attendance_sheets.id"],
),
sa.ForeignKeyConstraint(
["child_id"],
["children.id"],
),
)
op.drop_column("attendance_sheets", "month")
op.alter_column(
"visit_cadences", "caregiver_id", existing_type=sa.INTEGER(), nullable=False
)
op.alter_column(
"visit_cadences", "child_id", existing_type=sa.INTEGER(), nullable=True
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"visit_cadences", "child_id", existing_type=sa.INTEGER(), nullable=False
)
op.alter_column(
"visit_cadences", "caregiver_id", existing_type=sa.INTEGER(), nullable=True
)
op.add_column(
"attendance_sheets",
sa.Column(
"month",
postgresql.ENUM(
"JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
"MAY",
"JUNE",
"JULY",
"AUGUST",
"SEPTEMBER",
"OCTOBER",
"NOVEMBER",
"DECEMBER",
name="month",
),
autoincrement=False,
nullable=False,
),
)
op.drop_table("attendance_child")
# ### end Alembic commands ###