Add directory.disabled column

This commit is contained in:
Son NK 2020-12-07 10:48:43 +01:00
parent a40bbe74fe
commit 05d4ec1c2f
2 changed files with 31 additions and 0 deletions

View File

@ -1622,6 +1622,8 @@ class LifetimeCoupon(db.Model, ModelMixin):
class Directory(db.Model, ModelMixin):
user_id = db.Column(db.ForeignKey(User.id, ondelete="cascade"), nullable=False)
name = db.Column(db.String(128), unique=True, nullable=False)
# when a directory is disabled, new alias can't be created on the fly
disabled = db.Column(db.Boolean, default=False, nullable=False, server_default="0")
user = db.relationship(User)

View File

@ -0,0 +1,29 @@
"""empty message
Revision ID: 780a8344914b
Revises: c0d91ff18f77
Create Date: 2020-12-07 10:33:14.157476
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '780a8344914b'
down_revision = 'c0d91ff18f77'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('directory', sa.Column('disabled', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('directory', 'disabled')
# ### end Alembic commands ###