Repository navigation
[PostgreSQL] Use different schema #12296
Replies: 1 comment
|
Hi! The error appears when Doctrine Migrations tries to create PostgreSQL raises I would check the effective 1. Verify the active schemaRun these queries using the same database user and connection configuration as your Symfony application: SELECT current_user, current_schema();
SHOW search_path;
SELECT
nspname,
has_schema_privilege(current_user, oid, 'USAGE') AS can_use,
has_schema_privilege(current_user, oid, 'CREATE') AS can_create
FROM pg_namespace
WHERE nspname IN ('bosquenativo', 'public');If Also check that 2. Configure the search pathFor a quick test in a SQL session: SET search_path TO bosquenativo, public;
SELECT current_schema();If the application should consistently use this schema, an alternative is to configure the default at PostgreSQL level: ALTER ROLE app_user IN DATABASE mma
SET search_path TO bosquenativo, public;Replace This requires the appropriate administrative privileges and affects new connections for that role in that database. Reconnect before testing. The role must also have the necessary privileges on 3. Check how Doctrine receives the connection settingsYour URL contains: I would not assume this parameter is automatically applied as a PostgreSQL session setting by your installed DBAL/PDO driver combination. Check the effective connection settings from Symfony: php bin/console dbal:run-sql "SELECT current_user, current_schema()"
php bin/console dbal:run-sql "SHOW search_path"If the configured path is not effective, fix the connection initialization or use a properly configured database-level default. 4. Distinguish schema filtering from schema selectionThe The migration metadata table is created using Doctrine Migrations' connection and configuration. Its creation must also resolve to a valid schema. 5. Retry the migrationOnce php bin/console doctrine:migrations:status
php bin/console doctrine:migrations:migrateI would avoid rerunning Could you share the results of That should help determine whether the issue is caused by schema permissions, connection initialization, or Doctrine Migrations configuration. |
Uh oh!
There was an error while loading. Please reload this page.
Im using Symfony 6.4 and Doctrine 3.5 with doctrine-postgis. I need to use an specific schema but I'm not sure how is the proper way to do it nor found documentation about it. I tried using the
search_pathparam on my database url but I got an error with migrations.I set my database url like this:
The ran
doctrine:database:create,make:migrationanddoctrine:migrations:migrateand gotHere is a snippet of my
config/packages/doctrine.yamlAll reactions