app-MAIL-temp/migrations/versions/2020_032009_f4b8232fa17e_.py
2020-03-20 10:17:52 +01:00

46 lines
1.4 KiB
Python

"""empty message
Revision ID: f4b8232fa17e
Revises: 0809266d08ca
Create Date: 2020-03-20 09:41:21.840221
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f4b8232fa17e"
down_revision = "0809266d08ca"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("contact", sa.Column("user_id", sa.Integer(), nullable=True))
op.create_foreign_key(
None, "contact", "users", ["user_id"], ["id"], ondelete="cascade"
)
op.add_column("email_log", sa.Column("user_id", sa.Integer(), nullable=True))
op.create_foreign_key(
None, "email_log", "users", ["user_id"], ["id"], ondelete="cascade"
)
op.add_column("file", sa.Column("user_id", sa.Integer(), nullable=True))
op.create_foreign_key(
None, "file", "users", ["user_id"], ["id"], ondelete="cascade"
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "file", type_="foreignkey")
op.drop_column("file", "user_id")
op.drop_constraint(None, "email_log", type_="foreignkey")
op.drop_column("email_log", "user_id")
op.drop_constraint(None, "contact", type_="foreignkey")
op.drop_column("contact", "user_id")
# ### end Alembic commands ###