-
Notifications
You must be signed in to change notification settings - Fork 187
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
Manage migrations with postgres-migrations #507
Conversation
HBP specific migrations (e.g. auth, storage) are managed by HBP itself
This will also close #354. |
Fix missing dependencies to use cli_ext
try { | ||
await client.connect() | ||
await migrate({ client }, './db/migrations') | ||
} finally { |
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 is missing a catch block
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.
It's by design I think. If the migration fails HBP will fail (and restart) and try to apply the migrations again.
Docker should handle the restart with ex restart: always
in docker-compose.
@nunopato Is that correct or are we in fact missing something here?
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.
yeah, we want the exception to be thrown and the container fail to start.
HBP-specific migrations (
auth
) are currently being managed by Hasura, which makes it hard to release schema changes toauth
. This PR addspostgres-migrations
so that HBP manages its own migrations/schemas../db
./db/migrations
- migrations here should be specific to theauth
schema../db/00_init-schema.sql
creates extensions and the auth schema (not the tables) and it is used withdocker-entrypoint-initdb
when creating the DB the first time - this initialization will soon be moved to http://github.com/nhost/postgres.The metadata is still managed by Hasura and lives in
./db/hasura/metadata
.