我正在Laravel中使用名为Laravel Tenancy的多租户程序包,并且我更改了设置以与SCHEMA一起使用,每个租户都拥有正确的架构吗?
好吧,我使用的是postgres,我想更改“ public”默认模式,我想使用maindatabase。
我在以下位置进行了更改
'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',
],
]
但是当我执行 php artisan migration 时,我遇到了这个错误:
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))
我该如何解决?谢谢
答案 0 :(得分:1)
确保您对该模式具有所有USAGE特权,即:
GRANT USAGE ON SCHEMA maindatabase TO your_username;