feat(link_codes): linking method between telegram and website
This commit is contained in:
44
alembic/versions/6d1bae3dc723_link_codes.py
Normal file
44
alembic/versions/6d1bae3dc723_link_codes.py
Normal file
@@ -0,0 +1,44 @@
|
||||
"""+link_codes
|
||||
|
||||
Revision ID: 6d1bae3dc723
|
||||
Revises: 551c0ad261cd
|
||||
Create Date: 2026-08-18 20:19:35.961227
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '6d1bae3dc723'
|
||||
down_revision: Union[str, Sequence[str], None] = '551c0ad261cd'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('link_codes',
|
||||
sa.Column('code', sa.TEXT(), nullable=False),
|
||||
sa.Column('user_id', sa.INTEGER(), nullable=False),
|
||||
sa.Column('status', sa.Enum('ACTIVE', 'USED', 'EXPIRED', name='linkcodestatus'), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('used_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('code'),
|
||||
sa.UniqueConstraint('code')
|
||||
)
|
||||
op.create_unique_constraint(None, 'service_signatures', ['kid'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'service_signatures', type_='unique')
|
||||
op.drop_table('link_codes')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user