Skip to content
Snippets Groups Projects
Commit a9cf69cf authored by Sam Kagan's avatar Sam Kagan
Browse files

Merge branch 'WS-2353-add-casa-recipes-to-capabilities-table' into '2.8.4-DEVELOPMENT'

Added migration for CASA recipes and basic MS capability

See merge request !1650
parents ccbd1409 d9973166
No related branches found
No related tags found
2 merge requests!1706merge 2.8.4 to main,!1650Added migration for CASA recipes and basic MS capability
Pipeline #15527 passed
# Copyright (C) 2023 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/>.
#
"""add CASA recipes to capabilities
Also, add restore_basic_ms capability
Revision ID: 96477a05695d
Revises: 3c66bfdf76e3
Create Date: 2024-05-07 10:17:57.423155
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "96477a05695d"
down_revision = "3c66bfdf76e3"
branch_labels = None
depends_on = None
NEW_COLUMN_NAME = "casa_recipe"
NEW_CAPABILITY_NAME = "restore_basic_ms"
def upgrade():
op.add_column(
"capabilities",
sa.Column(
NEW_COLUMN_NAME,
sa.String,
comment="CASA recipe(s) to use for each capability, if any. alternatives will be separated by '|', sequences by ','",
),
)
op.execute(
f"""
UPDATE capabilities SET {NEW_COLUMN_NAME}='procedure_hifv_contimage_selfcal.xml'
WHERE capability_name='std_restore_imaging'
"""
)
op.execute(
f"""
UPDATE capabilities SET {NEW_COLUMN_NAME}='procedure_hifv_contimage_selfcal.xml'
WHERE capability_name='std_cms_imaging'
"""
)
op.execute(
f"""
UPDATE capabilities SET {NEW_COLUMN_NAME}='procedure_hifv.xml' WHERE capability_name='std_calibration'
"""
)
op.execute(
f"""
UPDATE capabilities SET {NEW_COLUMN_NAME}='template_hifv_deliver_ms.xml|template_hifa_deliver_ms.xml'
WHERE capability_name='restore_cms'
"""
)
op.execute(
f"""
INSERT INTO capabilities (capability_name, enabled, {NEW_COLUMN_NAME})
VALUES ('{NEW_CAPABILITY_NAME}', false, 'template_hifv_deliver_ms.xml|template_hifa_deliver_ms.xml')
"""
)
def downgrade():
op.execute(f"""DELETE FROM capabilities WHERE capability_name='{NEW_CAPABILITY_NAME}'""")
op.drop_column("capabilities", NEW_COLUMN_NAME)
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