Add CustomDomain.is_sl_subdomain and SLDomain.can_use_subdomain columns

This commit is contained in:
Son 2021-11-05 11:29:06 +01:00
parent 4214efa497
commit 3f1020d5d7
2 changed files with 41 additions and 0 deletions

View File

@ -1932,6 +1932,11 @@ class CustomDomain(Base, ModelMixin):
# the TXT record should be sl-verification=txt_token
ownership_txt_token = sa.Column(sa.String(128), nullable=True)
# if the domain is SimpleLogin subdomain, no need for the ownership, SPF, DKIM, DMARC check
is_sl_subdomain = sa.Column(
sa.Boolean, nullable=False, default=False, server_default="0"
)
__table_args__ = (
Index(
"ix_unique_domain", # Index name
@ -2447,6 +2452,11 @@ class SLDomain(Base, ModelMixin):
sa.Boolean, nullable=False, default=False, server_default="0"
)
# if True, the domain can be used for the subdomain feature
can_use_subdomain = sa.Column(
sa.Boolean, nullable=False, default=False, server_default="0"
)
def __repr__(self):
return f"<SLDomain {self.domain} {'Premium' if self.premium_only else 'Free'}"

View File

@ -0,0 +1,31 @@
"""empty message
Revision ID: fdb02bd105a8
Revises: ff6c04869029
Create Date: 2021-11-05 10:29:36.925291
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fdb02bd105a8'
down_revision = 'ff6c04869029'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('custom_domain', sa.Column('is_sl_subdomain', sa.Boolean(), server_default='0', nullable=False))
op.add_column('public_domain', sa.Column('can_use_subdomain', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('public_domain', 'can_use_subdomain')
op.drop_column('custom_domain', 'is_sl_subdomain')
# ### end Alembic commands ###