mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
add gen_email.custom_domain_id foreign key
This commit is contained in:
parent
86cc9b18aa
commit
24cb2688ca
|
@ -402,6 +402,10 @@ class GenEmail(db.Model, ModelMixin):
|
|||
# this email has been customized by user, i.e. not generated randomly
|
||||
custom = db.Column(db.Boolean(), default=False, nullable=False, server_default="0")
|
||||
|
||||
custom_domain_id = db.Column(
|
||||
db.ForeignKey("custom_domain.id", ondelete="cascade"), nullable=True
|
||||
)
|
||||
|
||||
user = db.relationship(User)
|
||||
|
||||
@classmethod
|
||||
|
|
31
migrations/versions/5e868298fee7_.py
Normal file
31
migrations/versions/5e868298fee7_.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: 5e868298fee7
|
||||
Revises: 0b28518684ae
|
||||
Create Date: 2019-12-02 00:28:40.281432
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5e868298fee7'
|
||||
down_revision = '0b28518684ae'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('gen_email', sa.Column('custom_domain_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'gen_email', 'custom_domain', ['custom_domain_id'], ['id'], ondelete='cascade')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'gen_email', type_='foreignkey')
|
||||
op.drop_column('gen_email', 'custom_domain_id')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue