fix: clinic doc delete
This commit is contained in:
parent
36c439ba0e
commit
611de1bf2a
|
|
@ -0,0 +1,38 @@
|
||||||
|
"""relation update
|
||||||
|
|
||||||
|
Revision ID: a19fede0cdc6
|
||||||
|
Revises: 48785e34c37c
|
||||||
|
Create Date: 2025-05-26 18:37:53.781411
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = 'a19fede0cdc6'
|
||||||
|
down_revision: Union[str, None] = '48785e34c37c'
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
"""Upgrade schema."""
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint('appointment_relations_clinic_doctor_id_fkey', 'appointment_relations', type_='foreignkey')
|
||||||
|
op.create_foreign_key(None, 'appointment_relations', 'clinic_doctors', ['clinic_doctor_id'], ['id'], ondelete='CASCADE')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
"""Downgrade schema."""
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.alter_column('users', 'clinicRole',
|
||||||
|
existing_type=sa.Enum('DIRECTOR', 'PRACTICE_MANAGER', name='clinicuserroles'),
|
||||||
|
type_=sa.VARCHAR(),
|
||||||
|
existing_nullable=True)
|
||||||
|
op.drop_constraint(None, 'appointment_relations', type_='foreignkey')
|
||||||
|
op.create_foreign_key('appointment_relations_clinic_doctor_id_fkey', 'appointment_relations', 'clinic_doctors', ['clinic_doctor_id'], ['id'])
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
@ -8,7 +8,7 @@ class AppointmentRelations(Base, CustomBase):
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
appointment_type_id = Column(Integer, ForeignKey("master_appointment_types.id"))
|
appointment_type_id = Column(Integer, ForeignKey("master_appointment_types.id"))
|
||||||
clinic_doctor_id = Column(Integer, ForeignKey("clinic_doctors.id"))
|
clinic_doctor_id = Column(Integer, ForeignKey("clinic_doctors.id", ondelete="CASCADE"))
|
||||||
|
|
||||||
clinicDoctors = relationship("ClinicDoctors", back_populates="appointmentRelations")
|
clinicDoctors = relationship("ClinicDoctors", back_populates="appointmentRelations")
|
||||||
masterAppointmentTypes = relationship("MasterAppointmentTypes", back_populates="appointmentRelations")
|
masterAppointmentTypes = relationship("MasterAppointmentTypes", back_populates="appointmentRelations")
|
||||||
Loading…
Reference in New Issue