mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 01:40:38 +01:00
Add refused_email model sql migration script
This commit is contained in:
parent
c4b97b55dc
commit
b583a8fc8d
1 changed files with 45 additions and 0 deletions
45
migrations/versions/2020_041422_12ff7dddbe3e_.py
Normal file
45
migrations/versions/2020_041422_12ff7dddbe3e_.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 12ff7dddbe3e
|
||||||
|
Revises: 91b69dfad2f1
|
||||||
|
Create Date: 2020-04-14 22:01:18.387344
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '12ff7dddbe3e'
|
||||||
|
down_revision = '91b69dfad2f1'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('refused_email',
|
||||||
|
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('full_report_path', sa.String(length=128), nullable=False),
|
||||||
|
sa.Column('path', sa.String(length=128), nullable=False),
|
||||||
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('delete_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('full_report_path'),
|
||||||
|
sa.UniqueConstraint('path')
|
||||||
|
)
|
||||||
|
op.add_column('forward_email_log', sa.Column('refused_email_id', sa.Integer(), nullable=True))
|
||||||
|
op.create_foreign_key(None, 'forward_email_log', 'refused_email', ['refused_email_id'], ['id'], ondelete='SET NULL')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint(None, 'forward_email_log', type_='foreignkey')
|
||||||
|
op.drop_column('forward_email_log', 'refused_email_id')
|
||||||
|
op.drop_table('refused_email')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in a new issue