-
Notifications
You must be signed in to change notification settings - Fork 4
Build out dev container #11
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
base: wip/samp/sample-data
Are you sure you want to change the base?
Build out dev container #11
Conversation
migrate.sh
Outdated
| psql -h localhost -U postgres -d hackspace -f "$file" | ||
| echo "$file" > last_migrated.txt | ||
| fi | ||
| done |
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 started life as a 1-liner and then grew. It should have probably become a python script as soon as I added statefulness via last_migrated.txt, but here we are :( If you feel strongly about it let me know and I'll convert it across.
I'm wondering whether we should start using something like https://flask-migrate.readthedocs.io/en/latest/index.html? It stores the migration version in the database itself, ensuring the version always stays in sync. The easiest option would probably be to condense all our existing scripts into a single migration, then continue from there I'm happy to use this script in the meantime though if it makes things a bit easier for you. |
|
Ooh, I like this idea - I haven't really worked in this stack before which is why I jumped at automating sql via bash. It probably makes sense for me to keep this PR open and move across to that over the next week or 2 rather than uproot everyone's dev process only to do it again in a few weeks time. Sorry this isn't in the thread, I can't seem to reply to comments - only create new ones... |
…mgmt into Build-out-dev-container
…ntainer app and db images to ensure compatible versions of postgres tooling, re-dump sample_dataset to contain schema version OOTB
|
Sorry for the delay! I had some time to work on this earlier this week, but got lost in a dependency versioning mess. I've pinned certain versions of the python dev container and the postgres images so that we can't mix up pgsql vs CLI versions when doing pg_dumps etc in future. This PR is now a breaking change. If you have a DB already, you will need to do the following:
I'm happy to be on hand during the real upgrade if we are concerned, but taking a backup and using that as a roll-back strategy is probably the safest bet. |
|
This is amazing work, thank you! I'll try and find some time to give it a proper review, especially the new migration. |
Here, I add a few quality-of-life improvements to make the dev experience as smooth as possible:
psqlCLI into the container.All included, a new developer should now just have to open the repository in a dev container enabled vscode and hit run!
@SamP20 I'm not sure how the migration script would fit in with your DB dump + sample data? I presume we could start with an empty DB, run your SQL script, set the "last_migrated.txt" to
migration/19_address_not_nulland debug from there?