Skip to content

Composite PK Support #62

Open
Open
@ptyork

Description

DBDiagram.io supports both a documented and an undocumented way of specifying composite primary keys.

Documented:

Table CourseSection {
    Year char(4)
    SemesterCode char(2)
    SectionCode char(2)
    CoursePrefix char(4) [ref: > Course.CoursePrefix]
    CourseNumber char(4) [ref: > Course.CourseNumber]
    InstructorID char(9) [ref: > Faculty.EmployeeID]
    RoomCode char(10) [ref: > Room.RoomCode]
    Indexes {
        (Year,SemesterCode,SectionCode,CoursePrefix,CourseNumber) [pk]
    }
}

Undocumented:

Table CourseSection {
    Year char(4) [pk]
    SemesterCode char(2) [pk]
    SectionCode char(2) [pk]
    CoursePrefix char(4) [pk, ref: > Course.CoursePrefix]
    CourseNumber char(4) [pk, ref: > Course.CourseNumber]
    InstructorID char(9) [ref: > Faculty.EmployeeID]
    RoomCode char(10) [ref: > Room.RoomCode]
}

Supporting the documented way would be a high-priority request given how common this scenario is...though obviously a 5-part key is an abomination that I'm using as an anti-pattern in a lecture. The undocumented way is quite nice for beginners.

Thanks!

PS - if you have no time but can process PR's, I will take a stab at my outstanding feature and bug reports.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions