add index for Alias custom_domain_id and directory_id columns
This commit is contained in:
parent
4faf0d7636
commit
205d8d7d3f
|
@ -1160,7 +1160,7 @@ class Alias(Base, ModelMixin):
|
||||||
enabled = sa.Column(sa.Boolean(), default=True, nullable=False)
|
enabled = sa.Column(sa.Boolean(), default=True, nullable=False)
|
||||||
|
|
||||||
custom_domain_id = sa.Column(
|
custom_domain_id = sa.Column(
|
||||||
sa.ForeignKey("custom_domain.id", ondelete="cascade"), nullable=True
|
sa.ForeignKey("custom_domain.id", ondelete="cascade"), nullable=True, index=True
|
||||||
)
|
)
|
||||||
|
|
||||||
custom_domain = orm.relationship("CustomDomain", foreign_keys=[custom_domain_id])
|
custom_domain = orm.relationship("CustomDomain", foreign_keys=[custom_domain_id])
|
||||||
|
@ -1172,7 +1172,7 @@ class Alias(Base, ModelMixin):
|
||||||
|
|
||||||
# to know whether an alias belongs to a directory
|
# to know whether an alias belongs to a directory
|
||||||
directory_id = sa.Column(
|
directory_id = sa.Column(
|
||||||
sa.ForeignKey("directory.id", ondelete="cascade"), nullable=True
|
sa.ForeignKey("directory.id", ondelete="cascade"), nullable=True, index=True
|
||||||
)
|
)
|
||||||
|
|
||||||
note = sa.Column(sa.Text, default=None, nullable=True)
|
note = sa.Column(sa.Text, default=None, nullable=True)
|
||||||
|
|
31
migrations/versions/2022_022617_5047fcbd57c7_.py
Normal file
31
migrations/versions/2022_022617_5047fcbd57c7_.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 5047fcbd57c7
|
||||||
|
Revises: 9282e982bc05
|
||||||
|
Create Date: 2022-02-26 17:51:03.379676
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '5047fcbd57c7'
|
||||||
|
down_revision = '9282e982bc05'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_index(op.f('ix_alias_custom_domain_id'), 'alias', ['custom_domain_id'], unique=False)
|
||||||
|
op.create_index(op.f('ix_alias_directory_id'), 'alias', ['directory_id'], unique=False)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index(op.f('ix_alias_directory_id'), table_name='alias')
|
||||||
|
op.drop_index(op.f('ix_alias_custom_domain_id'), table_name='alias')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in a new issue