mirror of
https://github.com/simple-login/app.git
synced 2025-02-22 14:53:34 +08:00
add necessary migration
This commit is contained in:
parent
cbfeee4e28
commit
0ad296fa69
2 changed files with 72 additions and 0 deletions
41
migrations/versions/2020_051016_bf11ab2f0a7a_.py
Normal file
41
migrations/versions/2020_051016_bf11ab2f0a7a_.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: bf11ab2f0a7a
|
||||
Revises: a5e3c6693dc6
|
||||
Create Date: 2020-05-10 16:41:48.038484
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'bf11ab2f0a7a'
|
||||
down_revision = 'a5e3c6693dc6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('alias_mailbox',
|
||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
|
||||
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('alias_id', sa.Integer(), nullable=False),
|
||||
sa.Column('mailbox_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['alias_id'], ['alias.id'], ondelete='cascade'),
|
||||
sa.ForeignKeyConstraint(['mailbox_id'], ['mailbox.id'], ondelete='cascade'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('alias_id', 'mailbox_id', name='uq_alias_mailbox')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('alias_mailbox')
|
||||
# ### end Alembic commands ###
|
31
migrations/versions/2020_051018_1759f73274ee_.py
Normal file
31
migrations/versions/2020_051018_1759f73274ee_.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 1759f73274ee
|
||||
Revises: bf11ab2f0a7a
|
||||
Create Date: 2020-05-10 18:33:55.376369
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1759f73274ee'
|
||||
down_revision = 'bf11ab2f0a7a'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('email_log', sa.Column('bounced_mailbox_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'email_log', 'mailbox', ['bounced_mailbox_id'], ['id'], ondelete='cascade')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'email_log', type_='foreignkey')
|
||||
op.drop_column('email_log', 'bounced_mailbox_id')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue