diff --git a/app/models.py b/app/models.py index f4c6f59c..6ed4ee0d 100644 --- a/app/models.py +++ b/app/models.py @@ -2665,3 +2665,11 @@ class DeletedDirectory(Base, ModelMixin): __tablename__ = "deleted_directory" name = sa.Column(sa.String(128), unique=True, nullable=False) + + +class DeletedSubdomain(Base, ModelMixin): + """To avoid directory from being reused""" + + __tablename__ = "deleted_subdomain" + + domain = sa.Column(sa.String(128), unique=True, nullable=False) diff --git a/migrations/versions/2021_111717_e6e8e12f5a13_.py b/migrations/versions/2021_111717_e6e8e12f5a13_.py new file mode 100644 index 00000000..b91963f4 --- /dev/null +++ b/migrations/versions/2021_111717_e6e8e12f5a13_.py @@ -0,0 +1,36 @@ +"""empty message + +Revision ID: e6e8e12f5a13 +Revises: a5013ff0a00a +Create Date: 2021-11-17 17:03:33.416076 + +""" +import sqlalchemy_utils +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'e6e8e12f5a13' +down_revision = 'a5013ff0a00a' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('deleted_subdomain', + 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('domain', sa.String(length=128), nullable=False), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('domain') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('deleted_subdomain') + # ### end Alembic commands ###