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
create unit_groups table, identical to courses table #35949
Conversation
a0a5efa
to
336492e
Compare
# create unit_groups as an exact copy of the courses table | ||
execute 'CREATE TABLE unit_groups LIKE courses' | ||
execute 'INSERT INTO unit_groups SELECT * FROM courses' |
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 strategy was borrowed from https://stackoverflow.com/questions/3280006/duplicating-a-mysql-table-indices-and-data/3280042#3280042
def remove_foreign_key_if_exists(table, key) | ||
remove_foreign_key table, column: key unless foreign_keys(table).find_index {|x| x.column == key.to_s}.nil? | ||
end |
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 utility method was borrowed from past migrations
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.
LGTM (assuming testing on clone goes well)
Specifically, adding the foreign key constraint on sections.course_id times out when run on an adhoc using a production db clone. This reverts commit f3e2539.
…de-dot-org into create-unit-groups-table
Background
One of many steps to complete PLAT-234. please see courses table rename proposal for context.
Description
create
unit_groups
as a complete copy (schema and contents) of thecourses
table, and remove any foreign key constraints against thecourses
table. This encompasses all migrations needed to fully switch to using theunit_groups
table in the next PR.Testing story
see design proposal
Reviewer Checklist: