60 lines
1.6 KiB
Markdown
60 lines
1.6 KiB
Markdown
Postman Method:
|
|
POST https://db.imex.online/v1alpha1/pg_dump
|
|
Set x-hasura-admin-secret header.
|
|
Body is RAW JSON:
|
|
|
|
```
|
|
{
|
|
"opts": ["-O", "-x", "--schema-only", "--schema", "public"],
|
|
"clean_output": true
|
|
}
|
|
```
|
|
|
|
Save output.
|
|
Manually export hasura metadata on production.
|
|
|
|
Go to new instance.
|
|
Run SQL
|
|
|
|
```
|
|
CREATE EXTENSION pg_trgm
|
|
```
|
|
|
|
Run SQL from PG Dump
|
|
Import hasura metadata.
|
|
|
|
//Done before IO BETA Release
|
|
Step 1: Nuke local migrations
|
|
Delete all the contents of your local migrations directory.
|
|
|
|
$ rm migrations/\*
|
|
Step 2: Reset the migration history on server
|
|
On the SQL tab of console, execute the following statement:
|
|
|
|
TRUNCATE hdb_catalog.schema_migrations;
|
|
Step 3: Pull the schema and metadata from server
|
|
Setup fresh migrations by taking the schema and metadata from the server:
|
|
|
|
## (available after version alpha45)
|
|
|
|
## create migration files (note that this will only export public schema from postgres)
|
|
|
|
$ hasura migrate create "init" --from-server
|
|
|
|
## note down the version
|
|
|
|
## mark the migration as applied on this server
|
|
|
|
$ hasura migrate apply --version "<version>" --skip-execution
|
|
If you are using schemas other than public, use --schema "schema_name" flag to indicate each one of them in the create
|
|
command. This flag can be used multiple times. See more details about the usage in the docs.
|
|
|
|
Step 4: Verify the status
|
|
Execute the following command to verify status of migration:
|
|
|
|
$ hasura migrate status
|
|
You have brand new migrations now!
|
|
|
|
This can also be used to combine (kind of squash) all of your migration files into a single one. You're snapshotting the
|
|
state of a server and adding it as a new migration.
|