GSA-TTS / jemison

An exploration of the space of search
Other
1 stars 0 forks source link

:truck: move migrations to their own app/deploy #25

Closed jadudm closed 1 week ago

jadudm commented 1 week ago

At a glance

In order to consistently maintain the PostgreSQL database as a devops person I want one migration file/tool

Acceptance Criteria

We use DRY behavior-driven development wherever possible.

### then... 
- [ ] remove migrations from `entree`
- [ ] centralize them at `internal/postgres`
- [ ] run migrations as `dbmate up` instead of as an embedded go executable?

Shepherd

Background

I have more than one place that Postgres is being touched. It needs to be consolidated early.

While it is fine for a certain amount of distribution of responsibility for the SQLite files (which... might also want for some centralization...), the Postgres database is singular. As a result, the migrations need to be in one place, so that they can be run by node 0 on a cloud foundry deploy. (I suppose every node could run the migrations... nothing would be hurt). But, that said, I need them in one place in the tree.

The question is whether to run them as dbmate up or embed them in an .exe and run them as a go command.

The benefit of the former is it eliminates an app.

The benefit of the latter is that we ship one executable (through the same build/process as everything else) and run it. It contains the migrations, statically compiled, and executes them.

Security Considerations

Required per CM-4.

None particularly. This has to do with build and deploy, and it will be gated via the normal commit/review process. Centralizing the migrations makes sure we're consistent with table shape updates, but does not impact boundaries.


Process checklist - [ ] Has a clear story statement - [ ] Can reasonably be done in a few days (otherwise, split this up!) - [ ] Shepherds have been identified - [ ] UX youexes all the things - [ ] Design designs all the things - [ ] Engineering engineers all the things - [ ] Meets acceptance criteria - [ ] Meets [QASP conditions](https://derisking-guide.18f.gov/qasp/) - [ ] Presented in a review - [ ] Includes screenshots or references to artifacts - [ ] Tagged with the sprint where it was finished - [ ] Archived ### If there's UI... - [ ] Screen reader - Listen to the experience with a screen reader extension, ensure the information presented in order - [ ] Keyboard navigation - Run through acceptance criteria with keyboard tabs, ensure it works. - [ ] Text scaling - Adjust viewport to 1280 pixels wide and zoom to 200%, ensure everything renders as expected. Document 400% zoom issues with USWDS if appropriate.
jadudm commented 1 week ago

The cmd/migrations directory is really just for having dbmate migrations against work-db. It isn't strictly a service.

However, I'm running them as a go app that gets compiled to serve.exe, and we run that. It saves the difficulty of having to ship the migrations and dbmate to the CF host.