From a2841739d027c4253f0fa7f2798207d16773c680 Mon Sep 17 00:00:00 2001 From: Sebastian Diaz Date: Wed, 7 Aug 2024 12:01:55 +0200 Subject: [PATCH] Add sequencing times for PacBio run (#3530)(patch) ## Description Add the following fields to the `PacBioSequencingRun` db model: - run_started_at - run_completed_at Remove `movie_time_hours` Create the alembic migration --- ...17cf7fea40d_add_sequencing_times_pacbio.py | 37 +++++++++++++++++++ cg/store/models.py | 3 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/2024_08_07_817cf7fea40d_add_sequencing_times_pacbio.py diff --git a/alembic/versions/2024_08_07_817cf7fea40d_add_sequencing_times_pacbio.py b/alembic/versions/2024_08_07_817cf7fea40d_add_sequencing_times_pacbio.py new file mode 100644 index 0000000000..6820adfa47 --- /dev/null +++ b/alembic/versions/2024_08_07_817cf7fea40d_add_sequencing_times_pacbio.py @@ -0,0 +1,37 @@ +"""Add sequencing times PacBio + +Revision ID: 817cf7fea40d +Revises: 601a2f272754 +Create Date: 2024-08-07 10:19:57.450266 + +""" + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "817cf7fea40d" +down_revision = "601a2f272754" +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column( + "pacbio_sequencing_run", sa.Column("run_started_at", sa.DateTime(), nullable=True) + ) + op.add_column( + "pacbio_sequencing_run", + sa.Column("run_completed_at", sa.DateTime(), nullable=True), + ) + op.drop_column("pacbio_sequencing_run", "movie_time_hours") + + +def downgrade(): + op.add_column( + "pacbio_sequencing_run", + sa.Column("movie_time_hours", sa.Integer(), nullable=True), + ) + op.drop_column("pacbio_sequencing_run", "run_completed_at") + op.drop_column("pacbio_sequencing_run", "run_started_at") diff --git a/cg/store/models.py b/cg/store/models.py index 0a266ac1d9..be739d2fd3 100644 --- a/cg/store/models.py +++ b/cg/store/models.py @@ -1089,7 +1089,8 @@ class PacBioSequencingRun(InstrumentRun): id: Mapped[int] = mapped_column(ForeignKey("instrument_run.id"), primary_key=True) well: Mapped[Str32] plate: Mapped[int] - movie_time_hours: Mapped[int] + started_at: Mapped[datetime | None] + completed_at: Mapped[datetime | None] movie_name: Mapped[Str32] hifi_reads: Mapped[BigInt] hifi_yield: Mapped[BigInt]