|
| 1 | +"""Adding permissions for owner |
| 2 | +
|
| 3 | +Revision ID: 43e8c59337ag |
| 4 | +Revises: 43e8c59337af |
| 5 | +Create Date: 2019-07-03 13:21:58.92665 |
| 6 | +
|
| 7 | +""" |
| 8 | + |
| 9 | +from alembic import op |
| 10 | +import sqlalchemy as sa |
| 11 | +import sqlalchemy_utils |
| 12 | + |
| 13 | + |
| 14 | + # revision identifiers, used by Alembic. |
| 15 | +revision = '43e8c59337ag' |
| 16 | +down_revision = '43e8c59337af' |
| 17 | + |
| 18 | + |
| 19 | +def upgrade(): |
| 20 | + op.execute("INSERT INTO permissions(role_id, service_id, can_create, can_read, can_update, can_delete) \ |
| 21 | + VALUES((SELECT id FROM roles WHERE name='owner'), (SELECT id from services where name='track'), \ |
| 22 | + true, true, true, true)", execution_options=None) |
| 23 | + |
| 24 | + op.execute("INSERT INTO permissions(role_id, service_id, can_create, can_read, can_update, can_delete) \ |
| 25 | + VALUES((SELECT id FROM roles WHERE name='owner'), (SELECT id from services where name='session'), \ |
| 26 | + true, true, true, true)", execution_options=None) |
| 27 | + |
| 28 | + op.execute("INSERT INTO permissions(role_id, service_id, can_create, can_read, can_update, can_delete) \ |
| 29 | + VALUES((SELECT id FROM roles WHERE name='owner'), (SELECT id from services where name='speaker'), \ |
| 30 | + true, true, true, true)", execution_options=None) |
| 31 | + |
| 32 | + op.execute("INSERT INTO permissions(role_id, service_id, can_create, can_read, can_update, can_delete) \ |
| 33 | + VALUES((SELECT id FROM roles WHERE name='owner'), (SELECT id from services where name='sponsor'), \ |
| 34 | + true, true, true, true)", execution_options=None) |
| 35 | + |
| 36 | + op.execute("INSERT INTO permissions(role_id, service_id, can_create, can_read, can_update, can_delete) \ |
| 37 | + VALUES((SELECT id FROM roles WHERE name='owner'), (SELECT id from services where name='microlocation'), \ |
| 38 | + true, true, true, true)", execution_options=None) |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +def downgrade(): |
| 43 | + op.execute("DELETE FROM permissions WHERE role_id=(SELECT id FROM roles WHERE name='owner')") |
0 commit comments