2023-03-02 20:20:31 -05:00
|
|
|
"""
|
|
|
|
|
|
2023-07-19 15:11:51 -07:00
|
|
|
Revision ID: 0387_remove_letter_perms_
|
|
|
|
|
Revises: 0385_remove_postage_
|
2023-03-02 20:20:31 -05:00
|
|
|
Create Date: 2023-02-17 11:56:00.993409
|
|
|
|
|
|
|
|
|
|
"""
|
2024-04-01 15:12:33 -07:00
|
|
|
|
2023-03-02 20:20:31 -05:00
|
|
|
import sqlalchemy as sa
|
2023-12-08 21:43:52 -05:00
|
|
|
from alembic import op
|
2023-03-02 20:20:31 -05:00
|
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
|
|
2023-08-29 14:54:30 -07:00
|
|
|
revision = "0387_remove_letter_perms_"
|
|
|
|
|
down_revision = "0385_remove_postage_"
|
2023-03-02 20:20:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
|
# this is the inverse of migration 0317
|
|
|
|
|
op.execute("DELETE from service_permissions where permission = 'upload_letters'")
|
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
|
# this is the inverse of migration 0317
|
2023-08-29 14:54:30 -07:00
|
|
|
op.execute(
|
|
|
|
|
"""
|
2023-03-02 20:20:31 -05:00
|
|
|
INSERT INTO
|
|
|
|
|
service_permissions (service_id, permission, created_at)
|
|
|
|
|
SELECT
|
|
|
|
|
id, 'upload_letters', now()
|
|
|
|
|
FROM
|
|
|
|
|
services
|
|
|
|
|
WHERE
|
|
|
|
|
NOT EXISTS (
|
|
|
|
|
SELECT
|
|
|
|
|
FROM
|
|
|
|
|
service_permissions
|
|
|
|
|
WHERE
|
|
|
|
|
service_id = services.id and
|
|
|
|
|
permission = 'upload_letters'
|
|
|
|
|
)
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ### end Alembic commands ###
|