mirror of
https://github.com/simple-login/app.git
synced 2025-11-12 02:40:45 +08:00
sql migration
This commit is contained in:
parent
eff0eb9e32
commit
249eab31e7
1 changed files with 33 additions and 0 deletions
33
migrations/versions/2020_050218_f939d67374e4_.py
Normal file
33
migrations/versions/2020_050218_f939d67374e4_.py
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: f939d67374e4
|
||||||
|
Revises: b4146f7d5277
|
||||||
|
Create Date: 2020-05-02 18:07:42.275092
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'f939d67374e4'
|
||||||
|
down_revision = 'b4146f7d5277'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('referral', sa.Column('name', sa.String(length=512), nullable=True))
|
||||||
|
op.drop_constraint('users_referral_id_fkey', 'users', type_='foreignkey')
|
||||||
|
op.create_foreign_key(None, 'users', 'referral', ['referral_id'], ['id'], ondelete='SET NULL')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint(None, 'users', type_='foreignkey')
|
||||||
|
op.create_foreign_key('users_referral_id_fkey', 'users', 'referral', ['referral_id'], ['id'])
|
||||||
|
op.drop_column('referral', 'name')
|
||||||
|
# ### end Alembic commands ###
|
||||||
Loading…
Add table
Reference in a new issue