mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 07:12:20 -05:00
Give folders to all existing services
Step 2 of 2 of shipping folders.
This commit is contained in:
38
migrations/versions/0254_folders_for_all.py
Normal file
38
migrations/versions/0254_folders_for_all.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0254_folders_for_all
|
||||
Revises: 0253_set_template_postage
|
||||
Create Date: 2019-01-08 13:30:48.694881+00
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision = '0254_folders_for_all'
|
||||
down_revision = '0253_set_template_postage'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("""
|
||||
INSERT INTO
|
||||
service_permissions (service_id, permission, created_at)
|
||||
SELECT
|
||||
id, '{permission}', now()
|
||||
FROM
|
||||
services
|
||||
WHERE
|
||||
NOT EXISTS (
|
||||
SELECT
|
||||
FROM
|
||||
service_permissions
|
||||
WHERE
|
||||
service_id = services.id and
|
||||
permission = '{permission}'
|
||||
)
|
||||
""".format(
|
||||
permission='edit_folders'
|
||||
))
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
Reference in New Issue
Block a user