hasura / hasura/graphql-engine

migration --from-server should take --exclude-schema argument

Open
#4,301 4 comments 1 reaction 1 assignee Claimed by @kolharsam View on GitHub
c/cli
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

When using `hasura migrate create "name" --from-server`, the migration does not contain the Postgres extensions. This will fail when used on a fresh database instance.

### Example
We're using a multi-database single-tenant setup, which means we have an Hasura instance for each database, and every database belongs to a single, specific tenant. All databases are structured the same way.

When creating the first migration from an existing database, the migration will not contain the `uuid-ossp`, and thus fails when applied to a fresh instance.

### Steps to reproduce
- **Setup**
- Postgres
- Create a new database
- Add the `uuid-ossp` extension
- Set up a table using that extension (e.g column `id uuid DEFAULT public.uuid_generate_v4() NOT
NULL`)
- Hasura
- Run a fresh instance and connect to the database
- `hasura init --directory my-project --endpoint http://localhost:8080`
- `cd my-project`
- `hasura migrate create "init" --from-server`
- **Reproduce**
- Drop the database and close the Hasura instance
- Create a new database and open a new Hasura instance
- Apply the migration: `hasura migrate apply --version ""`

This will fail (you can examine the generated up.sql. It does not contain the extension).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.