-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/archiving-retrieve-ddn-files' in…
…to archiving-retrieve-ddn-files
- Loading branch information
Showing
12 changed files
with
93 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
alembic/versions/2023_11_08_b105b426af99_rename_family_in_db.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"""Rename family in db | ||
Revision ID: b105b426af99 | ||
Revises: 70e641d723b3 | ||
Create Date: 2023-11-08 15:13:25.197537 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "b105b426af99" | ||
down_revision = "70e641d723b3" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Drop foreign key constraints that reference the unique constraint to be dropped | ||
op.drop_constraint("analysis_ibfk_1", "analysis", type_="foreignkey") | ||
op.drop_constraint("family_sample_ibfk_1", "family_sample", type_="foreignkey") | ||
|
||
# Rename tables | ||
op.rename_table("family", "case") | ||
op.rename_table("family_sample", "case_sample") | ||
|
||
# Rename foreign keys | ||
op.alter_column("analysis", "family_id", new_column_name="case_id", existing_type=sa.Integer()) | ||
op.alter_column( | ||
"case_sample", "family_id", new_column_name="case_id", existing_type=sa.Integer() | ||
) | ||
|
||
# Drop the unique constraint | ||
op.drop_constraint("_family_sample_uc", "case_sample", type_="unique") | ||
|
||
# Create the new unique constraint | ||
op.create_unique_constraint("_case_sample_uc", "case_sample", ["case_id", "sample_id"]) | ||
|
||
# Recreate foreign key constraints referencing the new unique constraint | ||
op.create_foreign_key("analysis_ibfk_1", "analysis", "case", ["case_id"], ["id"]) | ||
op.create_foreign_key("case_sample_ibfk_1", "case_sample", "case", ["case_id"], ["id"]) | ||
|
||
|
||
def downgrade(): | ||
# Drop foreign key constraints before renaming them back | ||
op.drop_constraint("analysis_ibfk_1", "analysis", type_="foreignkey") | ||
op.drop_constraint("case_sample_ibfk_1", "case_sample", type_="foreignkey") | ||
|
||
# Drop the unique constraint | ||
op.drop_constraint("_case_sample_uc", "case_sample", type_="unique") | ||
|
||
# Rename foreign keys back to original before renaming tables | ||
op.alter_column("analysis", "case_id", new_column_name="family_id", existing_type=sa.Integer()) | ||
op.alter_column( | ||
"case_sample", "case_id", new_column_name="family_id", existing_type=sa.Integer() | ||
) | ||
|
||
# Rename tables back to original | ||
op.rename_table("case", "family") | ||
op.rename_table("case_sample", "family_sample") | ||
|
||
# Recreate the original unique constraint | ||
op.create_unique_constraint("_family_sample_uc", "family_sample", ["family_id", "sample_id"]) | ||
|
||
# Recreate foreign key constraints referencing the original unique constraint | ||
op.create_foreign_key("analysis_ibfk_1", "analysis", "family", ["family_id"], ["id"]) | ||
op.create_foreign_key("family_sample_ibfk_1", "family_sample", "family", ["family_id"], ["id"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__title__ = "cg" | ||
__version__ = "52.1.2" | ||
__version__ = "52.1.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "cg" | ||
version = "52.1.2" | ||
version = "52.1.3" | ||
description = "Clinical Genomics command center" | ||
authors = ["Clinical Genomics <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters