我想知道是否有人知道上述内容是否可能实现,或者我是否做了荒谬的事情.这些连接细节适用于RDS(即blah.blah.eu-west-1.rds.amazonaws.com)数据库:
'db1' => [ 'driver' => 'pgsql','host' => env('DB_HOST_BRAIN'),'database' => env('DB_DATABASE_BRAIN'),'username' => env('DB_USERNAME_BRAIN'),'password' => env('DB_PASSWORD_BRAIN'),'charset' => 'utf8','prefix' => '','schema' => 'xyz_admin',],
但这些不适用于Redshift(即blah.blah.eu-west-1.redshift.amazonaws.com)数据库:
'db2' => [ 'driver' => 'pgsql','host' => env('DB_HOST_PINKY'),'database' => env('DB_DATABASE_PINKY'),'username' => env('DB_USERNAME_PINKY'),'password' => env('DB_PASSWORD_PINKY'),'port' => env('DB_PORT_PINKY'),'schema' => 'xyz',
假设所有细节都是正确的,有没有令人信服的理由说明为什么它永远不会起作用?有什么方法可以让它发挥作用吗?
只要环境变量正确,您的配置就可以连接到Redshift:
$take_over_the_world = DB::connection('db2')->select('SELECT tonight FROM going_to_do');