Skip to content
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

Merged
merged 7 commits into from Jul 30, 2020

Conversation

davidsbailey
Copy link
Member

@davidsbailey davidsbailey commented Jul 22, 2020

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 the courses table, and remove any foreign key constraints against the courses table. This encompasses all migrations needed to fully switch to using the unit_groups table in the next PR.

Testing story

see design proposal

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

Comment on lines +3 to +5
# 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'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +24 to +26
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
Copy link
Member Author

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

@davidsbailey davidsbailey marked this pull request as ready for review July 24, 2020 00:38
@davidsbailey davidsbailey mentioned this pull request Jul 24, 2020
7 tasks
Copy link

@uponthesun uponthesun left a 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)

@davidsbailey davidsbailey mentioned this pull request Jul 27, 2020
7 tasks
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.
@davidsbailey davidsbailey merged commit 220c785 into staging Jul 30, 2020
@davidsbailey davidsbailey deleted the create-unit-groups-table branch July 30, 2020 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants