update fixes, ...
This commit is contained in:
parent
c6042973fe
commit
1947a6f24a
31 changed files with 3395 additions and 145 deletions
|
@ -0,0 +1,48 @@
|
|||
"""fix app token
|
||||
|
||||
Revision ID: 0f217e90cd07
|
||||
Revises: 0518a8625b50
|
||||
Create Date: 2022-06-18 23:24:12.687324
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0f217e90cd07'
|
||||
down_revision = '0518a8625b50'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('app_token', sa.Column('user_id', sa.String(length=36), nullable=False))
|
||||
op.add_column('app_token', sa.Column('last_used', sa.DateTime(), nullable=True))
|
||||
op.create_foreign_key(None, 'app_token', 'user', ['user_id'], ['id'])
|
||||
op.add_column('totp', sa.Column('last_used', sa.DateTime(), nullable=True))
|
||||
tmp_table = sa.Table('_alembic_tmp_user', sa.MetaData())
|
||||
op.execute(sa.schema.DropTable(tmp_table, if_exists=True))
|
||||
with op.batch_alter_table('user') as batch_op:
|
||||
batch_op.alter_column('enabled',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=False,
|
||||
existing_server_default=sa.text("'false'"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
tmp_table = sa.Table('_alembic_tmp_user', sa.MetaData())
|
||||
op.execute(sa.schema.DropTable(tmp_table, if_exists=True))
|
||||
with op.batch_alter_table('user') as batch_op:
|
||||
batch_op.alter_column('enabled',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=True,
|
||||
existing_server_default=sa.text("'false'"))
|
||||
op.drop_column('totp', 'last_used')
|
||||
op.drop_constraint(None, 'app_token', type_='foreignkey')
|
||||
op.drop_column('app_token', 'last_used')
|
||||
op.drop_column('app_token', 'user_id')
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue