Changes between Version 6 and Version 7 of RelationalDesign


Ignore:
Timestamp:
09/11/26 00:16:19 (12 hours ago)
Author:
231035
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RelationalDesign

    v6 v7  
    1515  surname,
    1616  password_hash,
    17   created_at
    18 )
     17  created_at)
    1918
    2019- Admin(
    21   user_id [PK, FK→Users(user_id)]
    22 )
     20  user_id [PK, FK→Users(user_id)])
    2321
    2422- Client(
     
    2725  blocked_at,
    2826  blocked_reason,
    29   blocked_by [FK→Admin(user_id)]
    30 )
     27  blocked_by [FK→Admin(user_id)])
    3128
    3229- Owner(
    33   user_id [PK, FK→Client(user_id)]
    34 )
     30  user_id [PK, FK→Client(user_id)])
    3531
    3632- VetClinic(
    3733  clinic_id [PK],
    38   user_id [FK→Users(user_id), UQ]
    39 )
     34  user_id [FK→Users(user_id), UQ])
    4035
    4136VetClinic is also a specialization of Users. It keeps its own clinic_id as the primary key, while user_id connects it to the Users supertype.
    4237
    43 ---
     38----
    4439
    4540{{{ CLIENT INTERACTIONS }}}
     
    5247This represents the recursive Client–Client relationship `interaction_with`.
    5348
    54 ---
     49----
    5550
    5651{{{ NOTIFICATIONS }}}
     
    6257  message,
    6358  is_read,
    64   created_at
    65 )
    66 
    67 ---
     59  created_at)
     60
     61----
    6862
    6963{{{ VET CLINIC APPLICATIONS }}}
     
    8175  reviewed_at,
    8276  reviewed_by [FK→Admin(user_id)],
    83   denial_reason
    84 )
    85 
    86 ---
     77  denial_reason)
     78
     79----
    8780
    8881{{{ VET CLINICS }}}
     
    10093  work_days,
    10194  start_time,
    102   end_time
    103 )
    104 
    105 ---
     95  end_time)
     96
     97----
    10698
    10799{{{ ANIMALS }}}
     
    117109  species,
    118110  breed,
    119   located_name
    120 )
    121 
    122 ---
     111  located_name)
     112
     113----
    123114
    124115{{{ LISTINGS }}}
     
    131122  price,
    132123  description,
    133   created_at
    134 )
     124  created_at)
    135125
    136126- FavoriteListing(
    137127  fav_listing_id [PK],
    138128  user_id [FK→Users(user_id)],
    139   listing_id [FK→Listing(listing_id)]
    140 )
    141 
    142 ---
     129  listing_id [FK→Listing(listing_id)])
     130
     131----
    143132
    144133{{{ APPOINTMENTS }}}
     
    151140  status,
    152141  date_time,
    153   notes
    154 )
    155 
    156 ---
     142  notes)
     143
     144----
    157145
    158146{{{ REVIEWS: SUPERTYPE + SUBTYPES }}}
     
    165153  created_at,
    166154  updated_at,
    167   is_deleted
    168 )
     155  is_deleted)
    169156
    170157- UserReview(
    171158  review_id [PK, FK→Review(review_id)],
    172159  target_user_id [FK→Users(user_id)],
    173   interaction_type
    174 )
     160  interaction_type)
    175161
    176162- ClinicReview(
    177163  review_id [PK, FK→Review(review_id)],
    178164  target_clinic_id [FK→VetClinic(clinic_id)],
    179   appointment_id [FK→Appointment(appointment_id)]
    180 )
    181 
    182 ---
     165  appointment_id [FK→Appointment(appointment_id)])
     166
     167----
    183168
    184169{{{ HEALTH RECORDS }}}
     
    190175  type,
    191176  description,
    192   date
    193 )
    194 
    195 ---
     177  date)
     178
     179----
    196180
    197181{{{ CLINIC UNAVAILABLE SLOTS }}}
     
    202186  date_time,
    203187  reason,
    204   created_at
    205 )
    206 
    207 ---
     188  created_at)
     189
     190----
    208191
    209192== Business Rules Enforced in DDL / Triggers ==
     
    211194[[BR]]
    212195Review.rating must be in range 1–5.
    213 
    214196[[BR]]
    215197Review specialization is disjoint: one Review can be either UserReview or ClinicReview, not both.
    216 
    217198[[BR]]
    218199A Client can review a clinic only if they have at least one Appointment at that clinic with status = 'DONE'.
    219 
    220200[[BR]]
    221201A Client can leave a UserReview only for another Client/User with whom they have an existing ClientInteraction.
    222 
    223202[[BR]]
    224203ClientInteraction is recursive: both source_client_id and target_client_id reference Client(user_id).
    225 
    226204[[BR]]
    227205A Client cannot have an interaction with themselves.
    228 
    229206[[BR]]
    230207HealthRecord consistency: HealthRecord.animal_id must match Appointment.animal_id.
    231 
    232208[[BR]]
    233209UserReview.interaction_type must be one of the allowed interaction types defined in the DDL.