API Increased support to 9.2

Anything older than 9.3 is unsupported by Postgres: https://www.postgresql.org/support/versioning/.
I don't think we should claim support in our module for unsupported versions,
particularly if we don't have CI on them.

Since we're *only* running CI on 9.2 at the moment, that's the safe claim
for our module support, even though it's already unsupported by Postgres.
See https://docs.travis-ci.com/user/database-setup/#using-a-different-postgresql-version

I'll raise a separate ticket about testing and supporting newer versions,
it's out of scope for this PR.
This commit is contained in:
Ingo Schommer 2019-09-03 15:41:23 +12:00
parent d607a2bfa9
commit bf4fb87a01
2 changed files with 26 additions and 108 deletions

View File

@ -10,20 +10,37 @@
## Requirements
* SilverStripe 4.0
* PostgreSQL 8.3.x or greater must be installed
* PostgreSQL <8.3.0 may work if T-Search is manually installed
* Known to work on OS X Leopard, Windows Server 2008 R2 and Linux
* PostgreSQL >=9.2
* Note: PostgreSQL 10 has not been tested
## Installation
1. Install via composer `composer require silverstripe/postgresql` or extract the contents
so they reside as a `postgresql` directory inside your SilverStripe project code
2. Open the installer by browsing to install.php, e.g. http://localhost/silverstripe/install.php
3. Select PostgreSQL in the database list and enter your database details
```
composer require silverstripe/postgresql
```
## Configuration
### Environment file
Add the following settings to your `.env` file:
```
SS_DATABASE_CLASS=PostgreSQLDatabase
SS_DATABASE_USERNAME=
SS_DATABASE_PASSWORD=
```
See [environment variables](https://docs.silverstripe.org/en/4/getting_started/environment_management) for more details. Note that a database will automatically be created via `dev/build`.
### Through the installer
Open the installer by browsing to install.php, e.g. http://localhost/install.php
Select PostgreSQL in the database list and enter your database details
## Usage Overview
See docs/en for more information about configuring the module.
See [docs/en](docs/en/README.md) for more information about configuring the module.
## Known issues

View File

@ -1,86 +1,5 @@
# PostgreSQL Database Module
SilverStripe now has tentative support for PostgreSQL ('Postgres').
## Requirements
SilverStripe 2.4.0 or greater. (PostgreSQL support is NOT available
in 2.3.).
SilverStripe supports Postgres versions 8.3.x, 8.4.x and onwards.
Postgres 8.3.0 launched in February 2008, so SilverStripe has a fairly
modern but not bleeding edge Postgres version requirement.
Support for 8.2.x is theoretically possible if you're willing to manually
install T-search. 8.2.x has not been tested either, so there may be other
compatibility issues. The EnterpriseDB versions of Postgres also work, if
you'd prefer a tuned version.
## Installation
You have three options to install PostgreSQL support with SilverStripe.
### Option 1 - Installer
The first option is to use the installer. However, this is currently only
supported since SilverStripe 2.4.0 beta2 (or using the daily builds).
1. Set up SilverStripe somewhere where you can start the installer - you
should only see one database “MySQL” to install with.
2. Download a copy of the “postgresql” module from here:
http://silverstripe.org/postgresql-module
3. Extract the archive you downloaded. Rename the directory from
“postgresql-trunk-rxxxx” to “postgresql” and copy it into the SilverStripe
directory you just set up
4. Open the installer once again, and a new option “PostgreSQL” should appear.
You can now proceed through the installation without having to change any code.
### Option 2 - Manual
The second option is to setup PostgreSQL support manually. This can be achieved
by following these instructions:
1. Set up a fresh working copy of SilverStripe
2. Download a copy of the “postgresql” module from here: http://silverstripe.org/postgresql-module
3. Extract the archive you downloaded. Rename the directory from
“postgresql-trunk-rxxxx” to “postgresql” and copy it into the SilverStripe
directory you just set up.
4. Open up your mysite/_config.php file and add (or update) the $databaseConfig
array like so:
> $databaseConfig = array(
> 'type' => 'PostgreSQLDatabase',
> 'server' => '[server address e.g. localhost]',
> 'username' => 'postgres',
> 'password' => 'mypassword',
> 'database' => 'SS_mysite'
> );
Finally, visit dev/build so that SilverStripe can build the database schema and
default records.
### Option 3 - Environment file
Finally, the third option is to change your environment to point to
PostgreSQLDatabase as a database class. Do this if you're currently using an
_ss_environment.php file.
1. Download a copy of the “postgresql” module from here: http://silverstripe.org/postgresql-module
2. Extract the archive you downloaded. Rename the directory from
postgresql-trunk-rxxxx” to “postgresql” and copy it into your SS directory
3. Add the following to your existing _ss_environment.php file:
> define('SS_DATABASE_CLASS', 'PostgreSQLDatabase');
Last steps:
1. Ensure your SS_DATABASE_USERNAME and SS_DATABASE_PASSWORD defines in
_ss_environment.php are correct to the PostgreSQL server.
2. Ensure that your mysite/_config.php file has a database name defined, such
as “SS_mysite”.
3. Visit dev/build so that SilverStripe can build the database schema and
default records
## Features
Here is a quick list of what's different in the Postgres module (a full
@ -300,22 +219,4 @@ Otherwise this extension will try to connect to "postgres" Database to check DB
connection, no matter what you entered in the "Database Name" field during
installation.
Make sure you have set the "search_path" correct for your database user.
## Known Issues
All column and table names must be double-quoted. PostgreSQL automatically
lower-cases columns, and your queries will fail if you don't.
Ts_vector columns are not automatically detected by the built-in search filters.
That means if you're doing a search through the CMS on a ModelAdmin object, it
will use LIKE queries which are very slow.
If you're writing your own front-end search system, you can specify the columns
to use for search purposes, and you get the full benefits of T-Search.
If you are using unsupported modules, there may be instances of MySQL-specific
SQL queries which will need to be made database-agnostic where possible.
Make sure you have set the "search_path" correct for your database user.