Browse Source

Merge pull request #978 from racklin/pgsql-schema

Added support PostgreSQL schema.
Taylor Otwell 12 years ago
parent
commit
03d22362ec
2 changed files with 8 additions and 0 deletions
  1. 1 0
      application/config/database.php
  2. 7 0
      laravel/database/connectors/postgres.php

+ 1 - 0
application/config/database.php

@@ -85,6 +85,7 @@ return array(
 			'password' => '',
 			'charset'  => 'utf8',
 			'prefix'   => '',
+            'schema'   => 'public',
 		),
 
 		'sqlsrv' => array(

+ 7 - 0
laravel/database/connectors/postgres.php

@@ -44,6 +44,13 @@ class Postgres extends Connector {
 			$connection->prepare("SET NAMES '{$config['charset']}'")->execute();
 		}
 
+		// If a schema has been specified, we'll execute a query against
+		// the database to set the search path.
+		if (isset($config['schema']))
+		{
+			$connection->prepare("SET search_path TO '{$config['schema']}'")->execute();
+		}
+
 		return $connection;
 	}