mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 13:41:29 +02:00
chore: add custom domain indices (#2238)
This commit is contained in:
parent
b59ca3e47c
commit
80404b4dca
@ -2443,6 +2443,8 @@ class CustomDomain(Base, ModelMixin):
|
||||
unique=True,
|
||||
postgresql_where=Column("ownership_verified"),
|
||||
), # The condition
|
||||
Index("ix_custom_domain_user_id", "user_id"),
|
||||
Index("ix_custom_domain_pending_deletion", "pending_deletion"),
|
||||
)
|
||||
|
||||
user = orm.relationship(User, foreign_keys=[user_id], backref="custom_domains")
|
||||
|
@ -0,0 +1,27 @@
|
||||
"""custom domain indices
|
||||
|
||||
Revision ID: 62afa3a10010
|
||||
Revises: 88dd7a0abf54
|
||||
Create Date: 2024-09-30 11:40:04.127791
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '62afa3a10010'
|
||||
down_revision = '88dd7a0abf54'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.get_context().autocommit_block():
|
||||
op.create_index('ix_custom_domain_pending_deletion', 'custom_domain', ['pending_deletion'], unique=False, postgresql_concurrently=True)
|
||||
op.create_index('ix_custom_domain_user_id', 'custom_domain', ['user_id'], unique=False, postgresql_concurrently=True)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.get_context().autocommit_block():
|
||||
op.drop_index('ix_custom_domain_user_id', table_name='custom_domain', postgresql_concurrently=True)
|
||||
op.drop_index('ix_custom_domain_pending_deletion', table_name='custom_domain', postgresql_concurrently=True)
|
Loading…
Reference in New Issue
Block a user