2023-05-03 21:36:43 +00:00
|
|
|
"""empty message
|
|
|
|
|
2023-05-04 16:51:15 +00:00
|
|
|
Revision ID: 6aa02463da9c
|
2023-05-03 21:36:43 +00:00
|
|
|
Revises: 68adb1d504e1
|
2023-05-04 16:51:15 +00:00
|
|
|
Create Date: 2023-05-04 12:50:07.979692
|
2023-05-03 21:36:43 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2023-05-04 16:51:15 +00:00
|
|
|
revision = '6aa02463da9c'
|
2023-05-03 21:36:43 +00:00
|
|
|
down_revision = '68adb1d504e1'
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.create_table('active_user',
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('last_visited_identifier', sa.String(length=255), nullable=False),
|
2023-05-04 16:51:15 +00:00
|
|
|
sa.Column('last_seen_in_seconds', sa.Integer(), nullable=False),
|
2023-05-03 21:36:43 +00:00
|
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('user_id', 'last_visited_identifier', name='user_last_visited_unique')
|
|
|
|
)
|
|
|
|
with op.batch_alter_table('active_user', schema=None) as batch_op:
|
2023-05-04 16:51:15 +00:00
|
|
|
batch_op.create_index(batch_op.f('ix_active_user_last_seen_in_seconds'), ['last_seen_in_seconds'], unique=False)
|
2023-05-03 21:36:43 +00:00
|
|
|
batch_op.create_index(batch_op.f('ix_active_user_last_visited_identifier'), ['last_visited_identifier'], unique=False)
|
|
|
|
batch_op.create_index(batch_op.f('ix_active_user_user_id'), ['user_id'], unique=False)
|
|
|
|
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
with op.batch_alter_table('active_user', schema=None) as batch_op:
|
|
|
|
batch_op.drop_index(batch_op.f('ix_active_user_user_id'))
|
|
|
|
batch_op.drop_index(batch_op.f('ix_active_user_last_visited_identifier'))
|
2023-05-04 16:51:15 +00:00
|
|
|
batch_op.drop_index(batch_op.f('ix_active_user_last_seen_in_seconds'))
|
2023-05-03 21:36:43 +00:00
|
|
|
|
|
|
|
op.drop_table('active_user')
|
|
|
|
# ### end Alembic commands ###
|