Skip to content

Commit

Permalink
Fix creating unique index issue from initial squashed migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
somethingnew2-0 committed Mar 27, 2024
1 parent 70e4df6 commit ad15c87
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions migrations/versions/d6db40b0805d_initial_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ def upgrade():
sa.Column('employee_number', sa.Unicode(length=50), nullable=True),
sa.Column('manager_id', sa.Unicode(), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("email", name=op.f('idx_email'), postgresql_where=sa.text("deleted_at IS NULL")),
sa.UniqueConstraint("email", "deleted_at", name=op.f('idx_email_deleted_at'), postgresql_where=sa.text("deleted_at IS NOT NULL")),
sa.ForeignKeyConstraint(['manager_id'], ['okta_user.id'], name=op.f('fk_okta_user_manager_id_okta_user'))
)
with op.batch_alter_table('okta_user', schema=None) as batch_op:
batch_op.create_index('idx_email', ['email'], unique=True,
postgresql_where=sa.text('deleted_at IS NULL')
)
batch_op.create_index('idx_email_deleted_at', ['email', 'deleted_at'], unique=True,
postgresql_where=sa.text('deleted_at IS NOT NULL')
)
op.create_table(
"app_group",
sa.Column("id", sa.Unicode(), nullable=False),
Expand Down

0 comments on commit ad15c87

Please sign in to comment.