问题
I created new postgresql user:
CREATE ROLE lara_user SUPERUSER LOGIN PASSWORD 'mypassword';
Then create schema which is owned by this user
CREATE schema lara AUTHORIZATION lara_user;
In Laravel's .env
file I have
DB_DATABASE=postgres
DB_USERNAME=lara_user
DB_PASSWORD=mypassword
Laravel don't sees schema lara
and still connected to public
schema.
How can I change and set default schema lara
for Laravel ?
回答1:
in app/config/database.php
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'forge',
'username' => 'forge',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
来源:https://stackoverflow.com/questions/45242702/how-to-set-default-postgresql-schema-for-laravel