Skip to content
Snippets Groups Projects
Commit 1a8960d4 authored by Julian's avatar Julian
Browse files

Minor fix for last migration

Calling op.get_bind outside a callback broke "flask db history".
parent ac003909
No related branches found
No related tags found
No related merge requests found
"""Unified password hashing for User and Signup
"""unified password hashing for User and Signup
Revision ID: af07cea65391
Revises: 042879d5e3ac
......@@ -13,6 +13,7 @@ down_revision = '042879d5e3ac'
branch_labels = None
depends_on = None
def upgrade():
meta = sa.MetaData(bind=op.get_bind())
signup = sa.Table('signup', meta,
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
......@@ -29,7 +30,6 @@ signup = sa.Table('signup', meta,
sa.UniqueConstraint('user_id', name=op.f('uq_signup_user_id'))
)
def upgrade():
user = sa.Table('user', meta,
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('unix_uid', sa.Integer(), nullable=False),
......@@ -48,6 +48,22 @@ def upgrade():
op.execute(signup.update().values(pwhash=('{crypt}' + signup.c.pwhash)))
def downgrade():
meta = sa.MetaData(bind=op.get_bind())
signup = sa.Table('signup', meta,
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('token', sa.String(length=128), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('loginname', sa.Text(), nullable=True),
sa.Column('displayname', sa.Text(), nullable=True),
sa.Column('mail', sa.Text(), nullable=True),
sa.Column('pwhash', sa.Text(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('type', sa.String(length=50), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_signup_user_id_user'), onupdate='CASCADE', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id', name=op.f('pk_signup')),
sa.UniqueConstraint('user_id', name=op.f('uq_signup_user_id'))
)
user = sa.Table('user', meta,
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('unix_uid', sa.Integer(), nullable=False),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment