-
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.
Add order type application table (#3844) (minor)
### Added - OrderTypeApplication table
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
alembic/versions/2024_10_14_fd7c9d246255_add_ordertype_application_table.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,61 @@ | ||
"""Add ordertype application table | ||
Revision ID: fd7c9d246255 | ||
Revises: 3b165ec34791 | ||
Create Date: 2024-10-14 15:29:29.062523 | ||
""" | ||
|
||
from enum import Enum | ||
|
||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
from cg.constants import Workflow | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "fd7c9d246255" | ||
down_revision = "3b165ec34791" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
class OrderTypes(Enum): | ||
BALSAMIC: str = "balsamic" | ||
BALSAMIC_QC: str = "balsamic-qc" | ||
BALSAMIC_UMI: str = "balsamic-umi" | ||
FASTQ: str = "fastq" | ||
FLUFFY: str = "fluffy" | ||
METAGENOME: str = "metagenome" | ||
MICROBIAL_FASTQ: str = "microbial-fastq" | ||
MICROSALT: str = "microsalt" | ||
MIP_DNA: str = "mip-dna" | ||
MIP_RNA: str = "mip-rna" | ||
PACBIO_LONG_READ = "pacbio-long-read" | ||
RML: str = "rml" | ||
RNAFUSION: str = "rnafusion" | ||
SARS_COV_2: str = "sars-cov-2" | ||
TAXPROFILER: str = "taxprofiler" | ||
TOMTE: str = "tomte" | ||
|
||
|
||
order_type_column = sa.Column("order_type", sa.Enum(OrderTypes), index=True, nullable=False) | ||
application_column = sa.Column( | ||
"application_id", | ||
sa.Integer(), | ||
sa.ForeignKey("application.id", ondelete="CASCADE"), | ||
nullable=False, | ||
) | ||
|
||
|
||
def upgrade(): | ||
op.create_table( | ||
"order_type_application", | ||
order_type_column, | ||
application_column, | ||
sa.PrimaryKeyConstraint("order_type", "application_id"), | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table(table_name="order_type_application") |
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