Reputation: 203
Im using a multitenant package in Laravel called Laravel Tenancy and i change the setting to work with SCHEMA, every tenant has your schema right?
Well i'm using postgres and I'd like to change 'public' the default schema, i'd like to use maindatabase.
I have changed it in:
'connections' => [
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'maindatabase',
'sslmode' => 'prefer',
],
]
But when I execute php artisan migrate i have this error:
Illuminate\Database\QueryException : SQLSTATE[3F000]: Invalid schema name: 7 ERROR: no schema has been selected to create in at character 14 (SQL: create table "migrations" ("id" serial primary key not null, "migration" varchar(255) not null, "batch" integer not null))
How can I fix it? Thank you
Upvotes: 1
Views: 2542
Reputation: 9161
Make sure you have all USAGE privilege to that schema, i.e.:
GRANT USAGE ON SCHEMA maindatabase TO your_username;
Upvotes: 2