mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
93 lines
2.8 KiB
Python
93 lines
2.8 KiB
Python
"""rethought identifications
|
|
|
|
Revision ID: 443bbf86aba8
|
|
Revises: eef068c50335
|
|
Create Date: 2023-04-09 13:26:13.285339
|
|
|
|
"""
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "443bbf86aba8"
|
|
down_revision = "eef068c50335"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"patientidentification",
|
|
sa.Column("uid", sa.String(), nullable=False),
|
|
sa.Column("identification_uid", sa.String(), nullable=True),
|
|
sa.Column("patient_uid", sa.String(), nullable=True),
|
|
sa.Column("value", sa.String(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(), nullable=True),
|
|
sa.Column("created_by_uid", sa.String(), nullable=True),
|
|
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
|
sa.Column("updated_by_uid", sa.String(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["created_by_uid"],
|
|
["user.uid"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["identification_uid"],
|
|
["identification.uid"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["patient_uid"],
|
|
["patient.uid"],
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["updated_by_uid"],
|
|
["user.uid"],
|
|
),
|
|
sa.PrimaryKeyConstraint("uid"),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_patientidentification_uid"),
|
|
"patientidentification",
|
|
["uid"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
op.f("ix_patientidentification_value"),
|
|
"patientidentification",
|
|
["value"],
|
|
unique=False,
|
|
)
|
|
op.drop_table("patient_identification")
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"patient_identification",
|
|
sa.Column(
|
|
"identification_uid", sa.VARCHAR(), autoincrement=False, nullable=False
|
|
),
|
|
sa.Column("patient_uid", sa.VARCHAR(), autoincrement=False, nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["identification_uid"],
|
|
["identification.uid"],
|
|
name="patient_identification_identification_uid_fkey",
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["patient_uid"],
|
|
["patient.uid"],
|
|
name="patient_identification_patient_uid_fkey",
|
|
),
|
|
sa.PrimaryKeyConstraint(
|
|
"identification_uid", "patient_uid", name="patient_identification_pkey"
|
|
),
|
|
)
|
|
op.drop_index(
|
|
op.f("ix_patientidentification_value"), table_name="patientidentification"
|
|
)
|
|
op.drop_index(
|
|
op.f("ix_patientidentification_uid"), table_name="patientidentification"
|
|
)
|
|
op.drop_table("patientidentification")
|
|
# ### end Alembic commands ###
|