Skip to content
Snippets Groups Projects
Commit 7996da3b authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

Merge branch 'fix-full-curation-migrations' into '2.8.2.3-DEVELOPMENT'

final set of full curation migrations

See merge request !1603
parents bf9784bc 193a8427
No related branches found
No related tags found
3 merge requests!1606catch 2.8.3 up with main,!1605Merge 2.8.2.3 work to main,!1603final set of full curation migrations
Pipeline #14767 failed
......@@ -43,7 +43,8 @@ old_json = """{
"projectMetadata": {
"telescope": "{{telescope}}",
"projectCode": "{{projectCode}}"
}
}{{#file_list}},
"file_list": {{file_list}}{{/file_list}}
}
"""
......@@ -57,7 +58,8 @@ new_json = """{
"projectMetadata": {
"telescope": "{{telescope}}",
"projectCode": "{{projectCode}}"
}
}{{#file_list}},
"file_list": {{file_list}}{{/file_list}}
}
"""
......
"""update_curator_metadata2
Revision ID: e680d469ec4e
Revises: f49af22c5c0e
Create Date: 2024-03-12 15:05:15.771787
"""
from pathlib import Path
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "e680d469ec4e"
down_revision = "f49af22c5c0e"
branch_labels = None
depends_on = None
old_content = """{
"product_locator": "{{product_locator}}",{{#data_location}}
"data_location": "{{data_location}}",{{/data_location}}
"product_type": "{{product_type}}",{{#target_list}}
"target_list": ["{{target_list}}"],{{/target_list}}{{#product_group_id}}
"product_group_id": {{product_group_id}},{{/product_group_id}}{{#input_group_locator}}
"input_group_locator": "{{input_group_locator}}",{{/input_group_locator}}
"projectMetadata": {
"telescope": "{{telescope}}",
"projectCode": "{{projectCode}}"
}{{#file_list}},
"file_list": {{file_list}}{{/file_list}}
}
"""
new_content = (Path.cwd() / "versions" / "templates" / "curator" / "metadata_2.8.2.3.txt").read_text()
def upgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content=E'{new_content}'
WHERE filename='metadata.json' AND workflow_name='curator'
"""
)
def downgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content=E'{old_content}'
WHERE filename='metadata.json' AND workflow_name='curator'
"""
)
{
{{#product_locator}}"product_locator": "{{product_locator}}",{{/product_locator}}{{#data_src}}
"data_location": "{{data_src}}",{{/data_src}}
"product_type": "{{product_type}}",{{#target_list}}
"target_list": ["{{target_list}}"],{{/target_list}}{{#product_group_id}}
"product_group_id": {{product_group_id}},{{/product_group_id}}{{#input_group_locator}}
"input_group_locator": "{{input_group_locator}}",{{/input_group_locator}}
"projectMetadata": {
"telescope": "{{telescope}}",
"projectCode": "{{projectCode}}"
},
"file_list": "{{#file_list}}{{.}},{{/file_list}}"
}
\ No newline at end of file
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