Skip to content
Snippets Groups Projects
Commit 2cbf1a4a authored by Daniel Lyons's avatar Daniel Lyons
Browse files

Add the is_srdp flag... to the right place

parent aa20f4de
No related branches found
No related tags found
1 merge request!726Add the is_srdp flag... to the right place
Pipeline #4053 passed
#
# Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
#
# This file is part of NRAO Workspaces.
#
# Workspaces is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Workspaces is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
"""WS-705-correctly-update-is-srdp-flag-in-parameters
Revision ID: 786d860336fb
Revises: 744607468aeb
Create Date: 2022-01-18 09:21:22.390696
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "786d860336fb"
down_revision = "744607468aeb"
branch_labels = None
depends_on = None
def upgrade():
op.execute(
"""
update capability_versions set parameters = parameters::jsonb - 'is_srdp' where parameters::jsonb ? 'is_srdp';
update capability_versions
set parameters = jsonb_insert(parameters::jsonb, '{"metadata", "is_srdp"}', 'false', true)::json
where parameters::jsonb ? 'metadata' and not parameters::jsonb->'metadata' ? 'is_srdp';
"""
)
def downgrade():
op.execute(
"""
update capability_versions set parameters = (parameters->'metadata')::jsonb - 'is_srdp' where (parameters->'metadata')::jsonb ? 'is_srdp';
update capability_versions
set parameters = jsonb_insert(parameters::jsonb, '{"is_srdp"}', 'false', true)::json
where not parameters::jsonb ? 'is_srdp'
"""
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment