Set Schema for Postgres application database

Hi I'm trying to migrate my local Metabase H2 application database to production but would like to specify the destination schema so my "public" schema doesn't get flooded w/ Metabase tables.

I see that you can set the "database" via MB_DB_DBNAME environment variable but I'm limited to only the default 'postgres' database and would like to specify a schema instead. Is this possible?

Hi @lukep
You can define a non-default schema in the connection string with currentSchema=myschema, ex:

jdbc:postgresql://db.example.com:5432/mydb?user=dbuser&password=dbpassword&currentSchema=myschema

https://www.metabase.com/docs/latest/configuring-metabase/environment-variables#mb_db_connection_uri

1 Like

Thank you - this fixed the issue for me!