-
Notifications
You must be signed in to change notification settings - Fork 10
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
Enforce foreign keys for mobility translations #655
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #655 +/- ##
=======================================
Coverage 66.64% 66.64%
=======================================
Files 309 309
Lines 9386 9386
=======================================
Hits 6255 6255
Misses 3131 3131 ☔ View full report in Codecov by Sentry. |
I still need some convincing as to why we need these foreign keys. If they were that important, wouldn't they be mentioned in the migration guide from globalize to mobility? Also, I think it would be good to find out what the issue with staging is and to verify that it is independent of the PR under review. |
The issue with
You're right that this is unclear. I've opened an issue at |
I will convert this back to a draft until we get a response here: shioyama/mobility#641. This is not a blocker as |
In #609, we migrated from
globalize
tomobility
, a "Pluggable Ruby translation framework". We migrated according to their guide here. However, we didn't check our own migrations file. Now we noticed that three very old migrations cannot be run anymore because thecreate_translation_table!
method used in them was provided byglobalize
and is no longer part ofmobility
, see here.For testing purposes, in #654, we deleted those non-working migrations and completely setup the database again by deleting it entirely (also its schema), then running through all migrations. After that, we used the generator provided by
mobility
to generate the respective translation tables again:The resulting
schema.rb
can now be diffed with what we had before, see this diff. We made the following observations:t.text "name"
was added to the tablesubjects
,programs
anddivisions
. However, this field already exists in the respective translation tables, so we don't know why we would need it in the associated table as well. We don't change this in this PR asmobility
already worked in the last few months without this field. If we have problems with mobility in the future, this might be a possible reason.Note that in the translation tables the field
t.text
was just moved, so it seems like it was added there in the diff as well. It's different for the "non-translation tables"subjects
,programs
ordivisions
where the field was really newly added (there's no corresponding red "delete" line fort.text "name"
in those tables.I've added a
Migration
label to GitHub such that it's easier to find out which PRs were responsible for database migrations ;)Deployment to experimental
I've just deployed this commit to experimental and the server was not reachable afterwards. In the logs, I couldn't find any root cause, nor anything that pointed to the change I made here. I now reset experimental to a commit prior to db9d1f1, build it, then set it to db9d1f1 again and see if it works.
Edit: apparently it also doesn't work with the commit before this PR:
Edit: found the mistake, see this comment. TL;DR: the deployment issue was not related to this PR.