-
Notifications
You must be signed in to change notification settings - Fork 0
/
2023-01-30_a46d44436397_create_attendance_model.py
99 lines (91 loc) · 3.06 KB
/
2023-01-30_a46d44436397_create_attendance_model.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""Create attendance model
Revision ID: a46d44436397
Revises: 2ba84d84b1b7
Create Date: 2023-01-30 01:40:22.922458
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "a46d44436397"
down_revision = "2ba84d84b1b7"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"attendance_sheets",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("intake_id", sa.Integer(), nullable=True),
sa.Column("family_name", sa.String(), nullable=False),
sa.Column(
"month",
sa.Enum(
"JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
"MAY",
"JUNE",
"JULY",
"AUGUST",
"SEPTEMBER",
"OCTOBER",
"NOVEMBER",
"DECEMBER",
name="month",
),
nullable=False,
),
sa.Column("cic", sa.String(), nullable=False),
sa.Column("cpw", sa.String(), nullable=False),
sa.Column("riv", sa.String(), nullable=False),
sa.ForeignKeyConstraint(
["intake_id"],
["intakes.id"],
),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"attendance_records",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("attendace_sheet_id", sa.Integer(), nullable=False),
sa.Column(
"supervision",
sa.Enum("FULL", "PARTIAL", "UNSUPERVISED", name="supervision"),
nullable=False,
),
sa.Column("date", sa.String(), nullable=False),
sa.Column("start_time", sa.String(), nullable=False),
sa.Column("end_time", sa.String(), nullable=False),
sa.Column("place", sa.String(), nullable=False),
sa.Column(
"attendance",
sa.Enum("PRESENT", "CANCELLED", "NO_SHOW", name="attendace"),
nullable=False,
),
sa.Column(
"attending_parent",
sa.Enum("MOM", "DAD", name="attending_parent"),
nullable=True,
),
sa.Column("staff_transport_time_min", sa.Integer(), nullable=True),
sa.Column("driver_transport_time_min", sa.Integer(), nullable=True),
sa.Column("foster_parent_transport_time_min", sa.Integer(), nullable=True),
sa.Column("access_worker_id", sa.Integer(), nullable=True),
sa.Column("comments", sa.String(), nullable=False),
sa.ForeignKeyConstraint(
["access_worker_id"],
["users.id"],
),
sa.ForeignKeyConstraint(
["attendace_sheet_id"],
["attendance_sheets.id"],
),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("attendance_records")
op.drop_table("attendance_sheets")
# ### end Alembic commands ###