laravel 如何为laravel设置默认的postgresql架构?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45242702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set default postgresql schema for laravel?
提问by Oto Shavadze
I created new postgresql user:
我创建了新的 postgresql 用户:
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
在 Laravel 的.env
文件中,我有
DB_DATABASE=postgres
DB_USERNAME=lara_user
DB_PASSWORD=mypassword
Laravel don't sees schema lara
and still connected to public
schema.
Laravel 看不到架构lara
并且仍然连接到public
架构。
How can I change and set default schema lara
for Laravel ?
如何更改和设置lara
Laravel 的默认架构?
回答by Exprator
in app/config/database.php
在 app/config/database.php
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'forge',
'username' => 'forge',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),