forked from platypush/platypush
🐛 Don't add the new password salt/iterations columns if already present.
And, similarly, don't remove them if they aren't on the user table.
This commit is contained in:
parent
901338e228
commit
6a8c83f99b
1 changed files with 10 additions and 4 deletions
|
@ -27,8 +27,11 @@ def upgrade() -> None:
|
||||||
print('The table `user` does not exist, skipping migration')
|
print('The table `user` does not exist, skipping migration')
|
||||||
return
|
return
|
||||||
|
|
||||||
op.add_column('user', sa.Column('password_salt', sa.String(), nullable=True))
|
if 'password_salt' not in user_table.columns:
|
||||||
op.add_column('user', sa.Column('hmac_iterations', sa.Integer(), nullable=True))
|
op.add_column('user', sa.Column('password_salt', sa.String(), nullable=True))
|
||||||
|
|
||||||
|
if 'hmac_iterations' not in user_table.columns:
|
||||||
|
op.add_column('user', sa.Column('hmac_iterations', sa.Integer(), nullable=True))
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
|
@ -41,5 +44,8 @@ def downgrade() -> None:
|
||||||
print('The table `user` does not exist, skipping migration')
|
print('The table `user` does not exist, skipping migration')
|
||||||
return
|
return
|
||||||
|
|
||||||
op.drop_column('user', 'password_salt')
|
if 'password_salt' in user_table.columns:
|
||||||
op.drop_column('user', 'hmac_iterations')
|
op.drop_column('user', 'password_salt')
|
||||||
|
|
||||||
|
if 'hmac_iterations' in user_table.columns:
|
||||||
|
op.drop_column('user', 'hmac_iterations')
|
||||||
|
|
Loading…
Reference in a new issue