Upgrade from v1 to v2
Upgrading from Nhost v1 to v2 requires changes to the database schema and hasura metadata.
If you need help migrating from v1 to v2 please contact Johan: johan@nhost.io

mkdir -p nhost-v2/nhost
echo "version: 2" > nhost-v2/nhost/config.yaml

Inside nhost-v2/
hasura migrate create init --from-server --endpoint=[v1-endpoint] --admin-secret=[v1-admin-secret]
hasura metadata export --endpoint=[v1-endpoint] --admin-secret=[v1-admin-secret]

Edit the up.sql migration created.
  • Delete all auth.* tables and functions.
  • Delete public.users table
  • Update FK references from public.users to auth.users.
  • Add OR REPLACE after CREATE for the public.set_current_timestamp_updated_at function
Update metadata.
  • Delete tracking all tables in the auth schema.
  • Delete tracking the public.users table.
  • Update all references to users from public to auth schema.
Start Nohst CLI
nhost -d

Open Docker UI and restart Hasura Auth and Hasura Storage. This will reapply migrations and metadata for the auth and the storage schema.
Move the current migrations folder to ex migrations-bk.
Change config version from config: 2 to config: 3 in the nhost/config.yaml file.
hasura metadata export --endpoint=http://localhost:1337 --admin-secret=nhost-admin-secret

To match hasura config v3, move all migrations inside migrations/default folder.
mkdir -p migrations/default
cp -r migrations/* migrations/default/

Database migrations and metadata are now pulled from the remote Nhost v1 backend, edited for Nhost v2 and updated for Hasura Configuration v3.