Add unique constraints on some of our tables
I just missed thinking about this originally
This commit is contained in:
parent
9eef6c9754
commit
63a22e27e0
2 changed files with 33 additions and 2 deletions
28
alembic/versions/4990a9f1ada3_add_unique_constraints.py
Normal file
28
alembic/versions/4990a9f1ada3_add_unique_constraints.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
"""add unique constraints
|
||||
|
||||
Revision ID: 4990a9f1ada3
|
||||
Revises: 688af5ecd407
|
||||
Create Date: 2016-05-18 15:40:33.511871
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4990a9f1ada3'
|
||||
down_revision = '688af5ecd407'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_unique_constraint('uq_credit_card_id', 'credit_card', ['card_id'])
|
||||
op.create_unique_constraint('uq_ofxsource_fid', 'ofxsource', ['fid'])
|
||||
op.create_unique_constraint('uq_user_username', 'users', ['username'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('uq_user_username', 'users', type_='unique')
|
||||
op.drop_constraint('uq_ofxsource_fid', 'ofxsource', type_='unique')
|
||||
op.drop_constraint('uq_credit_card_id', 'credit_card', type_='unique')
|
Loading…
Add table
Add a link
Reference in a new issue