commit | 851d18bdd21273760aa7924554180e7701e4122d | [log] [tgz] |
---|---|---|
author | Julie Qiu <julie@golang.org> | Fri Jan 03 16:17:52 2020 -0500 |
committer | Julie Qiu <julie@golang.org> | Fri Mar 27 16:46:50 2020 -0400 |
tree | b0c617867b21dfb47036367610307a33b02bd6a4 | |
parent | 3a1c21670c69e77e69cbcad7d2f557383d2634c5 [diff] |
internal/postgres: update logic for deleting an alternative module When an alternative module is deteled, module_version_states is now updated to reflect the state of that module. The imports for the alternative module are deleted from the imports_unique table. Updates b/133176189 Change-Id: Ie259b97f02e80f0905ca81edf3d89fabbd4f31e3 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/629282 Reviewed-by: Jonathan Amsterdam <jba@google.com>
Migrations are managed with the golang-migrate/migrate CLI tool.
To run all the migrations:
migrate -source file:migrations -database "postgres://localhost:5432/discovery-database?sslmode=disable" up
To create a new migration:
migrate create -ext sql -dir migrations -seq <title>
This creates two empty files in /migrations
:
{version}_{title}.up.sql {version}_{title}.down.sql
The two migration files are used to migrate “up” to the specified version from the previous version, and to migrate “down” to the previous version. See golang-migrate/migrate/MIGRATIONS.md for details.