Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
655 Add User Roles and Basic User Data to Db #668
655 Add User Roles and Basic User Data to Db #668
Changes from all commits
b6d612d
b308c8f
7fb329f
e874eeb
353a545
a7f06ab
8657569
d76be3d
aacbeb4
18b427a
773b6b0
1519028
5d14a91
356798c
a99d61f
59bd09f
40f0834
7513df7
2c5a7dc
440424d
cf7c862
e6383e0
5a67602
91eb3cb
86addbe
b11fed9
6ad02dd
95cb5d2
996fd14
7bd721d
74f861e
4a1ac90
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means there can be duplicate role names. The
id
column isn't strictly necessary. Thename
column can be the primary key.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, the
id
isn't strictly necessary, but it does provide us the flexibility to rename the roles at any time. I think being able to easily rename our roles is worth storing 4-10 extra integers in the db.To your point about duplicate names, I added a safeguard against this in 6ad02dd by adding the
unique=True
constraint to therole.name
field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
on update cascade
can also be considered easy when defining a table. What other reasons are there to use a surrogate key?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using surrogate keys like an id field offers several advantages beyond the ease of updates provided by
ON UPDATE CASCADE
. Surrogate keys are unique and stable, providing an abstraction layer that decouples database structure from business logic, thus reducing the need for changes due to business modifications. They enhance performance with quicker indexing and simplify relational management by avoiding the complexities and potential performance issues of cascading updates. Additionally, surrogate keys maintain data integrity by minimizing risks associated with data duplication and erroneous updates, making them ideal for robust, scalable database architectures.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a chatgpt response? 😄 Do these reasons apply to this data model?