-
Notifications
You must be signed in to change notification settings - Fork 0
/
7f8c48727acf_add_user_read.py
50 lines (42 loc) · 1.31 KB
/
7f8c48727acf_add_user_read.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
"""Add user read
Revision ID: 7f8c48727acf
Revises: 4bea3bfdd457
Create Date: 2021-02-16 16:47:41.159745
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "7f8c48727acf"
down_revision = "4bea3bfdd457"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"user_read_token",
sa.Column("creation_time", sa.DateTime(), nullable=False),
sa.Column("token", sa.Text(), nullable=False),
sa.Column("valid_until", sa.DateTime(), 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("token"),
)
op.create_index(
op.f("ix_user_read_token_user_id"),
"user_read_token",
["user_id"],
unique=False,
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_user_read_token_user_id"), table_name="user_read_token"
)
op.drop_table("user_read_token")
# ### end Alembic commands ###