fix(db): declare onDelete on required FKs that had none
Eight required (nullable:false) FKs had no referential action. Set per the codebase's existing pattern: CASCADE for owned relations (doctor_insurances, doctor_secretaries), RESTRICT for owner/reference FKs (Doctor/Clinic.user_id, invited_by_id, subscription plan/period). Only the two CASCADE FKs need DDL — RESTRICT is the MySQL default.
This commit is contained in:
@@ -27,11 +27,11 @@ class ClinicSubscription
|
||||
private int $entityId;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: SubscriptionPlan::class)]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: 'RESTRICT')]
|
||||
private SubscriptionPlan $plan;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: SubscriptionPeriod::class)]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: 'RESTRICT')]
|
||||
private SubscriptionPeriod $period;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Payment::class)]
|
||||
|
||||
@@ -19,7 +19,7 @@ class SubscriptionPeriod
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: SubscriptionPlan::class, inversedBy: 'periods')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: 'RESTRICT')]
|
||||
private SubscriptionPlan $plan;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 50)]
|
||||
|
||||
Reference in New Issue
Block a user