diff --git a/.upgrade.yml b/.upgrade.yml new file mode 100644 index 0000000..1f11da7 --- /dev/null +++ b/.upgrade.yml @@ -0,0 +1,9 @@ +mappings: + PostgreSQLConnector: SilverStripe\PostgreSQL\PostgreSQLConnector + PostgreSQLDatabase: SilverStripe\PostgreSQL\PostgreSQLDatabase + PostgreSQLDatabaseConfigurationHelper: SilverStripe\PostgreSQL\PostgreSQLDatabaseConfigurationHelper + PostgreSQLQuery: SilverStripe\PostgreSQL\PostgreSQLQuery + PostgreSQLQueryBuilder: SilverStripe\PostgreSQL\PostgreSQLQueryBuilder + PostgreSQLSchemaManager: SilverStripe\PostgreSQL\PostgreSQLSchemaManager + PostgreSQLConnectorTest: SilverStripe\PostgreSQL\Test\PostgreSQLConnectorTest + PostgreSQLDatabaseTest: SilverStripe\PostgreSQL\Test\PostgreSQLDatabaseTest diff --git a/_config/connectors.yml b/_config/connectors.yml index 7792b20..1da3e7a 100644 --- a/_config/connectors.yml +++ b/_config/connectors.yml @@ -3,14 +3,21 @@ name: postgresqlconnectors --- Injector: PostgrePDODatabase: - class: 'PostgreSQLDatabase' + class: 'SilverStripe\PostgreSQL\PostgreSQLDatabase' properties: connector: %$PDOConnector schemaManager: %$PostgreSQLSchemaManager queryBuilder: %$PostgreSQLQueryBuilder PostgreSQLDatabase: - class: 'PostgreSQLDatabase' + class: 'SilverStripe\PostgreSQL\PostgreSQLDatabase' properties: connector: %$PostgreSQLConnector schemaManager: %$PostgreSQLSchemaManager - queryBuilder: %$PostgreSQLQueryBuilder \ No newline at end of file + queryBuilder: %$PostgreSQLQueryBuilder + PostgreSQLConnector: + class: 'SilverStripe\PostgreSQL\PostgreSQLConnector' + type: prototype + PostgreSQLSchemaManager: + class: 'SilverStripe\PostgreSQL\PostgreSQLSchemaManager' + PostgreSQLQueryBuilder: + class: 'SilverStripe\PostgreSQL\PostgreSQLQueryBuilder' diff --git a/_register_database.php b/_register_database.php index 95eacce..9872131 100644 --- a/_register_database.php +++ b/_register_database.php @@ -2,7 +2,7 @@ // PDO Postgre database DatabaseAdapterRegistry::register(array( - 'class' => 'PostgrePDODatabase', + 'class' => 'SilverStripe\\PostgreSQL\PostgrePDODatabase', 'title' => 'PostgreSQL 8.3+ (using PDO)', 'helperPath' => dirname(__FILE__).'/code/PostgreSQLDatabaseConfigurationHelper.php', 'supported' => (class_exists('PDO') && in_array('postgresql', PDO::getAvailableDrivers())), @@ -15,7 +15,7 @@ DatabaseAdapterRegistry::register(array( // PDO Postgre database DatabaseAdapterRegistry::register(array( - 'class' => 'PostgreSQLDatabase', + 'class' => 'SilverStripe\\PostgreSQL\PostgreSQLDatabase', 'title' => 'PostgreSQL 8.3+ (using pg_connect)', 'helperPath' => dirname(__FILE__).'/code/PostgreSQLDatabaseConfigurationHelper.php', 'supported' => function_exists('pg_connect'), diff --git a/code/PostgreSQLConnector.php b/code/PostgreSQLConnector.php index 3dd945d..5196462 100644 --- a/code/PostgreSQLConnector.php +++ b/code/PostgreSQLConnector.php @@ -1,5 +1,13 @@ get('PostgreSQLDatabase', 'default_fts_cluster_method'); + return Config::inst()->get('SilverStripe\\PostgreSQL\\PostgreSQLDatabase', 'default_fts_cluster_method'); } /** @@ -45,7 +61,7 @@ class PostgreSQLDatabase extends SS_Database */ public static function default_fts_search_method() { - return Config::inst()->get('PostgreSQLDatabase', 'default_fts_search_method'); + return Config::inst()->get('SilverStripe\\PostgreSQL\\PostgreSQLDatabase', 'default_fts_search_method'); } /** @@ -61,7 +77,7 @@ class PostgreSQLDatabase extends SS_Database */ public static function allow_query_master_postgres() { - return Config::inst()->get('PostgreSQLDatabase', 'allow_query_master_postgres'); + return Config::inst()->get('SilverStripe\\PostgreSQL\\PostgreSQLDatabase', 'allow_query_master_postgres'); } /** @@ -76,7 +92,7 @@ class PostgreSQLDatabase extends SS_Database */ public static function model_schema_as_database() { - return Config::inst()->get('PostgreSQLDatabase', 'model_schema_as_database'); + return Config::inst()->get('SilverStripe\\PostgreSQL\\PostgreSQLDatabase', 'model_schema_as_database'); } /** @@ -88,7 +104,7 @@ class PostgreSQLDatabase extends SS_Database */ public static function search_language() { - return Config::inst()->get('PostgreSQLDatabase', 'search_language'); + return Config::inst()->get('SilverStripe\\PostgreSQL\\PostgreSQLDatabase', 'search_language'); } /** diff --git a/code/PostgreSQLDatabaseConfigurationHelper.php b/code/PostgreSQLDatabaseConfigurationHelper.php index cf7ba7c..5afa4b3 100644 --- a/code/PostgreSQLDatabaseConfigurationHelper.php +++ b/code/PostgreSQLDatabaseConfigurationHelper.php @@ -1,4 +1,12 @@