-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor db relationships #114
base: main
Are you sure you want to change the base?
Conversation
7e581ee
to
7498263
Compare
WIP: work on course_settings WIP: continued work on the course settings WIP: continued work on course_settings. TEST: mojolicious route testing for settings. WIP: continued work on course settings
WIP: allow default settings to be defined in an override file.
WIP: fix up tests and general cleanup. WIP: fix up tests and general cleanup.
FIX: fixes after rebasing.
7498263
to
9c1d4cc
Compare
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.
Many-to-many relationships are also pluralized.
@@ -66,16 +66,16 @@ __PACKAGE__->set_primary_key('course_id'); | |||
|
|||
# set up the many-to-many relationship to users | |||
__PACKAGE__->has_many(course_users => 'DB::Schema::Result::CourseUser', 'course_id'); | |||
__PACKAGE__->many_to_many(users => 'course_users', 'users'); | |||
__PACKAGE__->many_to_many(users => 'course_users', 'user'); |
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 should remain plural.
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.
I was using the example in https://metacpan.org/pod/DBIx::Class::Relationship#many_to_many
It seems that the 3rd argument is the same as the belongs_to in the bridging table. I don't think this is an accessor name. The example cited above used singular for this relationship (actor and role).
@@ -63,6 +63,6 @@ __PACKAGE__->add_columns( | |||
|
|||
__PACKAGE__->set_primary_key('db_perm_id'); | |||
__PACKAGE__->has_many(db_perm_roles => 'DB::Schema::Result::DBPermRole', 'db_perm_id'); | |||
__PACKAGE__->many_to_many(roles => 'db_perm_roles', 'roles'); | |||
__PACKAGE__->many_to_many(roles => 'db_perm_roles', 'role'); |
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 should remain plural.
__PACKAGE__->has_many(db_perm_roles => 'DB::Schema::Result::DBPermRole', 'role_id'); | ||
__PACKAGE__->many_to_many(db_perms => 'db_perm_roles', 'db_perms'); | ||
__PACKAGE__->many_to_many(db_permissions => 'db_perm_roles', 'db_permission'); |
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 should remain plural.
@@ -115,6 +115,6 @@ __PACKAGE__->set_primary_key('user_id'); | |||
__PACKAGE__->add_unique_constraint([qw/username/]); | |||
|
|||
__PACKAGE__->has_many(course_users => 'DB::Schema::Result::CourseUser', 'user_id'); | |||
__PACKAGE__->many_to_many(courses => 'course_users', 'courses'); | |||
__PACKAGE__->many_to_many(course => 'course_users', 'course'); |
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 should remain plural.
This changes assessor names in the DBIx::Class relationships for consistency. For singular relationships, the 's' has been dropped.
Note: this is based on #106, which has some changes to the CourseSettings database tables.