-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path4928dc3f0b07_create_event_table.py
More file actions
43 lines (34 loc) · 1.73 KB
/
4928dc3f0b07_create_event_table.py
File metadata and controls
43 lines (34 loc) · 1.73 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
38
39
40
41
42
43
"""create_event_table
Revision ID: 4928dc3f0b07
Revises: 0a2c458d1ddd
Create Date: 2026-05-24 17:39:22.538239
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '4928dc3f0b07'
down_revision: Union[str, None] = '0a2c458d1ddd'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('event_info',
sa.Column('eid', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('start_time', sa.DateTime(timezone=True), nullable=False),
sa.Column('end_time', sa.DateTime(timezone=True), nullable=False),
sa.Column('frequency', sa.String(length=64), server_default=sa.text("'NONE'"), nullable=True),
sa.Column('repeat_start_date', sa.Date(), nullable=True),
sa.Column('repeat_end_date', sa.Date(), nullable=True),
sa.CheckConstraint("frequency IN ('NONE', 'DAILY', 'WEEKLY', 'MONTHLY', 'SEMESTERLY', 'YEARLY')", name=op.f('ck_event_info_valid_frequency_value')),
sa.CheckConstraint('repeat_start_date < repeat_end_date', name=op.f('ck_event_info_check_repeat_start_date_before_repeat_end_date')),
sa.CheckConstraint('start_time < end_time', name=op.f('ck_event_info_check_start_time_before_end_time')),
sa.PrimaryKeyConstraint('eid', name=op.f('pk_event_info'))
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('event_info')
# ### end Alembic commands ###