Changeset 1a9c843 for sql


Ignore:
Timestamp:
09/23/26 13:29:06 (22 hours ago)
Author:
Stefan-Saveski <stefansaveski19@…>
Branches:
master
Children:
e7bafc0
Parents:
a12988e (diff), f7c8acf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/phase5-normalization'

Location:
sql
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • sql/data_load.sql

    ra12988e r1a9c843  
    115115(3, 1, 'tok_old789_stefan', '2026-01-01 00:00:00', FALSE);
    116116
    117 INSERT INTO payment (id, user_id, enrollment_id, amount) VALUES
    118 (1, 1, 1, 200),
    119 (2, 1, 2, 200),
    120 (3, 2, 3, 400),
    121 (4, 3, 4, 200);
     117INSERT INTO payment (id, enrollment_id, amount) VALUES
     118(1, 1, 200),
     119(2, 2, 200),
     120(3, 3, 400),
     121(4, 4, 200);
    122122
    123123INSERT INTO major_subjects (major_id, subject_id, mandatory_semester) VALUES
  • sql/iknow.dbml

    ra12988e r1a9c843  
    150150Table project.payment {
    151151  id integer [pk, increment]
    152   user_id integer [not null]
    153152  enrollment_id integer [not null]
    154153  amount integer [not null]
     
    188187Ref: project.contact.user_id - project.users.id                      // has_contact (1:1)
    189188Ref: project.token.user_id > project.users.id                        // has_token
    190 Ref: project.payment.user_id > project.users.id                      // pays
    191189Ref: project.payment.enrollment_id > project.enrolled_semesters.id   // for_enrollment
    192190Ref: project.enrolled_semesters.user_id > project.users.id           // submits
  • sql/schema.md

    ra12988e r1a9c843  
    111111    payment {
    112112        integer id PK
    113         integer user_id FK
    114113        integer enrollment_id FK
    115114        integer amount
     
    136135    users               ||--o| contact            : has_contact
    137136    users               ||--o{ token              : has_token
    138     users               ||--o{ payment            : pays
    139137    users               ||--o{ enrolled_semesters : submits
    140138    users               ||--o{ user_documents     : owns
     
    184182  they differ.
    185183- `professour_subjects` keeps the spelling used by the table in `schema_creation.sql`.
     184- `payment` has no `user_id`: the student is reached through `enrollment_id`.
     185  Storing it twice violated BCNF (`enrolled_id -> user_id`) and allowed a
     186  payment to contradict the enrolment it refers to. Removed in Phase 5.
  • sql/schema_creation.sql

    ra12988e r1a9c843  
    115115CREATE TABLE payment (
    116116    id             INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    117     user_id        INTEGER NOT NULL REFERENCES users (id),
    118117    enrollment_id  INTEGER NOT NULL REFERENCES enrolled_semesters (id),
    119118    amount         INTEGER NOT NULL
Note: See TracChangeset for help on using the changeset viewer.