-
Notifications
You must be signed in to change notification settings - Fork 0
/
6ff0c4124a0c_add_regulation_computation_table.py
56 lines (48 loc) · 1.42 KB
/
6ff0c4124a0c_add_regulation_computation_table.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
"""add regulation computation table
Revision ID: 6ff0c4124a0c
Revises: 22a0e898310e
Create Date: 2022-09-27 15:29:11.402233
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "6ff0c4124a0c"
down_revision = "22a0e898310e"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"regulation_computation",
sa.Column(
"creation_time",
sa.DateTime(),
nullable=False,
),
sa.Column("day", sa.Date(), nullable=False),
sa.Column(
"submitter_type",
sa.Enum(
"employee", "admin", name="submittertype", native_enum=False
),
nullable=False,
),
sa.Column("user_id", sa.Integer(), nullable=False),
sa.Column("id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["user_id"],
["user.id"],
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint(
"day",
"user_id",
"submitter_type",
name="only_one_entry_per_user_day_and_submitter_type",
),
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("regulation_computation")
# ### end Alembic commands ###