Changes between Version 4 and Version 5 of RelationalDesign
- Timestamp:
- 09/02/26 20:07:38 (4 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RelationalDesign
v4 v5 1 1 = Relational Design = 2 2 3 This page documents the relational design for BEST Skopje Hub, based on ERModel_v1 0. The design uses partial transformation from the ER model into a PostgreSQL relational schema. Strong entities are mapped directly to relations, weak entities include the primary keys of their owner entities, specializations are mapped with one relation for the supertype and one relation for each subtype, and M:N relationships are mapped as separate relations.3 This page documents the relational design for BEST Skopje Hub, based on ERModel_v11. The design uses partial transformation from the ER model into a PostgreSQL relational schema. Strong entities are mapped directly to relations, weak entities include the primary keys of their owner entities, specializations are mapped with one relation for the supertype and one relation for each subtype, and M:N relationships are mapped as separate relations. 4 4 5 5 == Descriptive representation of the relational schema == … … 132 132 ) 133 133 134 event_function_types( 135 eft_id, eft_name, 136 PK(eft_id), 137 UNIQUE(eft_name) 138 ) 139 134 140 event_sessions( 135 141 ee_id, es_no, est_id, l_id, es_start_time, es_title, needed_no_volunteers, … … 141 147 142 148 event_functions( 143 ee_id, ef_no, ef _name,149 ee_id, ef_no, eft_id, 144 150 PK(ee_id, ef_no), 145 FK(ee_id) -> event_editions(ee_id) 151 FK(ee_id) -> event_editions(ee_id), 152 FK(eft_id) -> event_function_types(eft_id) 146 153 ) 147 154 … … 155 162 ) 156 163 164 holds_event_function( 165 student_index, ee_id, ef_no, 166 PK(student_index, ee_id, ef_no), 167 FK(student_index) -> members(student_index), 168 FK(ee_id, ef_no) -> event_functions(ee_id, ef_no) 169 ) 170 157 171 participation( 158 172 student_index, as_id, rsvp_status, rsvp_at, attendance_status, … … 162 176 ) 163 177 178 required_attendance( 179 student_index, as_id, 180 PK(student_index, as_id), 181 FK(student_index) -> members(student_index), 182 FK(as_id) -> activity_sessions(as_id) 183 ) 184 164 185 announces_absence( 165 186 student_index, as_id, reason, announced_at, 166 187 PK(student_index, as_id), 167 FK(student_index) -> members(student_index), 168 FK(as_id) -> activity_sessions(as_id) 188 FK(student_index, as_id) -> required_attendance(student_index, as_id) 169 189 ) 170 190 … … 202 222 The specialization of students into members and then into observers, young members, full members, and alumni is represented through subtype tables whose primary keys are also foreign keys. `young_members` also contains `mentor_index`, which represents the mentorship relationship directly as a foreign key to `full_members`. 203 223 204 The weak entities from ERModel_v1 0are represented with composite primary keys where they still depend on an owner entity. `event_functions` uses `(ee_id, ef_no)`, and `event_sessions` uses `(ee_id, es_no)`. Other concrete entities such as `activity_sessions` and `event_editions` use their own numeric identifiers.224 The weak entities from ERModel_v11 are represented with composite primary keys where they still depend on an owner entity. `event_functions` uses `(ee_id, ef_no)`, and `event_sessions` uses `(ee_id, es_no)`. Other concrete entities such as `activity_sessions` and `event_editions` use their own numeric identifiers. 205 225 206 226 The Locations entity is represented with `locations`. The relationship between !EventEditions and Locations is represented with `event_edition_locations`. 207 227 208 The relationships `has_stage`, `participation`, ` announces_absence`, `responsible_for`, `volunteers`, `cooperation`, `related_to`, `holds_function`, and the event-edition location relationship are represented as relations because they either have M:N cardinality, their own attributes, or are clearer without nullable foreign-key columns. The relationship `related_to` is represented separately because only some activity sessions are connected to event editions. The relationship `applies_with` is represented with the foreign key `student_index` in `applications`, because each application belongs to one student. The N:1 relationships `for_function`, `for_participation`, `takes_place_at`, `held_at`, and `mentorship` are represented directly with foreign keys on the N-side relation.228 The relationships `has_stage`, `participation`, `required_attendance`, `announces_absence`, `responsible_for`, `volunteers`, `cooperation`, `related_to`, `holds_function`, `holds_event_function`, and the event-edition location relationship are represented as relations because they either have M:N cardinality, their own attributes, or are clearer without nullable foreign-key columns. The relationship `related_to` is represented separately because only some activity sessions are connected to event editions. The relationship `applies_with` is represented with the foreign key `student_index` in `applications`, because each application belongs to one student. The N:1 relationships `for_function`, `for_participation`, `takes_place_at`, `held_at`, `is_of_function_type`, and `mentorship` are represented directly with foreign keys on the N-side relation. 209 229 210 230 == DDL script for creating the database schema and objects == … … 216 236 == DML script for filling tables with data == 217 237 218 The DML script recreates realistic sample data for all relations. It clears the current contents of the tables and inserts connected sample data for students, members, membership stages, activity sessions, event-related activity links, event editions, event sessions, applications, companies, volunteering, mentorship, attendance/RSVP, announced absences, and organizational functions.238 The DML script recreates realistic sample data for all relations. It clears the current contents of the tables and inserts connected sample data for students, members, membership stages, activity sessions, event-related activity links, event editions, event sessions, event function types, event function slots, actual event function holders, applications, companies, volunteering, mentorship, attendance/RSVP, required attendance, announced absences, and organizational functions. 219 239 220 240 [attachment:data_load.sql data_load.sql] … … 228 248 == AI Use == 229 249 230 AI was used during this phase as a consultation, drafting, and checking tool while preparing the relational design from the already completed ERModel_v1 0. The AI-assisted parts were reviewed against the existing ER model and project requirements before being included.250 AI was used during this phase as a consultation, drafting, and checking tool while preparing the relational design from the already completed ERModel_v11. The AI-assisted parts were reviewed against the existing ER model and project requirements before being included. 231 251 232 252 Full AI usage documentation: [wiki:RelationalDesignAIUsage RelationalDesignAIUsage].
