-
Notifications
You must be signed in to change notification settings - Fork 4
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
Determine protocol for developing/testing database schema changes #340
Comments
An additional wrinkle is how to handle testing a schema change itself. The database refresh scripts and the web app containing the tests are separate repositories (which I argued for previously), and the dev database, at the moment, only refreshes once a day. One option is to tie any change to the main repository of the database refresh directory to a rerun of the prod-to-dev logic, and then immediately run the tests after the merge, rolling back the PR if any tests fail. That could even be automated. |
Personally I like the ideas of 2 and 4. Seems like a good compromise over 🦊. Devs will be able to test locally to make sure their changes don't implode the whole system |
@EvilDrPurple The good news is that in that case, the existing dump_prod_to_dev.sh can be reused with at most minor modifications (if that) to dump dev to a local database. The tricky part will be setting up the local database so that the shell script will work with it. That'll probably take some trials. Additionally, the presence of the data in the database is a concern. There is user info, contact information and unencrypted API keys, among other things, which we may not want to have available to every developer working on this level. The workaround to that would be ensuring that only the schema, and not the data, is provided, although that will make things annoying to people testing their changes, as they'll need to provide fake data. |
@maxachis I see, is there any way to provide data just from non-sensitive tables or even provide fake filler data instead of the actual thing? |
@EvilDrPurple Oh absolutely! It'll just take some time to figure out how to do that and set up the implementation. Ideally, my goal is to have you and others be able to work on developing database-impacting changes right away, but I want to make sure the protocol is sustainable and @josh-chamberlain - approved. |
in any case, if we all just try to publish our branches and make draft PRs, claim issues (all seem to be happening), there shouldn't be any unrecoverable conflicts. |
I will begin work on setting up an additional database and figuring out dummy data. |
So now that we've set up a development database, we face a few new challenges related to how we set up and test database schema changes.
Currently, the development database is refreshed from production once a day, using the code within the prod-to-dev migration repository. Within that repository is a script called dev_scripts.sql which includes a set of schema changes to be applied to the development database after the prod-to-dev refresh. So the development database is refreshed from prod, and then this script is called making the additional modifications to the schema. Any recent schema changes to the dev DB which are not in this script are effectively wiped during the next refresh.
What should we do if we have multiple people developing and testing out database changes, and making code which runs off of those database changes? Part of the complication is that the automated test scripts we have in the Github repository run against the development database. If developer A makes changes to the dev database schema, and developer B makes a pull request, B's PR will be tested against the modified dev database, and some tests may fail because of schema changes B doesn't know about.
There's a few options, not all of them mutually exclusive:
dev_scripts.sql
, with a PR made for each.So we need to decide on what is best, and also develop Gitbook documentation detailing how that works.
The text was updated successfully, but these errors were encountered: