This commit is contained in:
Kenneth Kehl
2023-08-29 14:54:30 -07:00
parent 19dcd7a48b
commit 1ecb747c6d
588 changed files with 34100 additions and 23589 deletions

View File

@@ -8,16 +8,23 @@ Create Date: 2019-06-04 13:49:50.685493
from alembic import op
import sqlalchemy as sa
revision = '0295_api_key_constraint'
down_revision = '0294_add_verify_reply_to'
revision = "0295_api_key_constraint"
down_revision = "0294_add_verify_reply_to"
def upgrade():
op.drop_constraint('uix_service_to_key_name', 'api_keys', type_='unique')
op.create_index('uix_service_to_key_name', 'api_keys', ['service_id', 'name'], unique=True,
postgresql_where=sa.text('expiry_date IS NULL'))
op.drop_constraint("uix_service_to_key_name", "api_keys", type_="unique")
op.create_index(
"uix_service_to_key_name",
"api_keys",
["service_id", "name"],
unique=True,
postgresql_where=sa.text("expiry_date IS NULL"),
)
def downgrade():
op.drop_index('uix_service_to_key_name', table_name='api_keys')
op.create_unique_constraint('uix_service_to_key_name', 'api_keys', ['service_id', 'name'])
op.drop_index("uix_service_to_key_name", table_name="api_keys")
op.create_unique_constraint(
"uix_service_to_key_name", "api_keys", ["service_id", "name"]
)