1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

починка2

This commit is contained in:
MoonTestUse1
2025-01-04 03:41:21 +06:00
parent 87fc83a6d2
commit e7034c84b3
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
"""create tokens table
Revision ID: create_tokens_table
Revises:
Create Date: 2024-01-03 22:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'create_tokens_table'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'tokens',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('token', sa.String(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()')),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_tokens_token'), 'tokens', ['token'], unique=True)
op.create_index(op.f('ix_tokens_user_id'), 'tokens', ['user_id'], unique=False)
def downgrade():
op.drop_index(op.f('ix_tokens_user_id'), table_name='tokens')
op.drop_index(op.f('ix_tokens_token'), table_name='tokens')
op.drop_table('tokens')

Binary file not shown.