class PostgreSQLSchemaManager extends DBSchemaManager (View source)

PostgreSQL schema manager

Constants

ID

Identifier for this schema, used for configuring schema-specific table creation options

Properties

protected PostgreSQLDatabase $database

Instance of the database controller this schema belongs to

protected bool $supressOutput

If this is false, then information about database operations will be displayed, eg creation of tables.

from  DBSchemaManager
protected array $tableList

The table list, generated by the tableList() function.

from  DBSchemaManager
protected bool $schemaIsUpdating

Keeps track whether we are currently updating the schema.

from  DBSchemaManager
protected array $schemaUpdateTransaction

Large array structure that represents a schema update transaction

from  DBSchemaManager
protected static array $cached_constraints

This holds a copy of all the constraint results that are returned via the function constraintExists(). This is a bit faster than repeatedly querying this column, and should allow the database to use it's built-in caching features for better queries.

protected static array $cached_fieldlists

This holds a copy of all the queries that run through the function fieldList() This is one of the most-often called functions, and repeats itself a great deal in the unit tests.

Methods

public
setDatabase(SS_Database $database)

Injector injection point for database controller

public
quiet()

Enable supression of database messages.

public
query(string $sql, int $errorLevel = E_USER_ERROR)

Execute the given SQL query.

public
preparedQuery(string $sql, array $parameters, int $errorLevel = E_USER_ERROR)

Execute the given SQL parameterised query with the specified arguments

public
schemaUpdate($callback)

Initiates a schema update within a single callback

public
cancelSchemaUpdate()

Cancels the schema updates requested during (but not after) schemaUpdate() call.

public
bool
isSchemaUpdating()

Returns true if we are during a schema update.

public
bool
doesSchemaNeedUpdating()

Returns true if schema modifications were requested during (but not after) schemaUpdate() call.

public
transCreateTable(string $table, array $options = null, array $advanced_options = null)

Instruct the schema manager to record a table creation to later execute

public
transAlterTable(string $table, array $options, array $advanced_options)

Instruct the schema manager to record a table alteration to later execute

public
transCreateField(string $table, string $field, string $schema)

Instruct the schema manager to record a field to be later created

public
transCreateIndex(string $table, string $index, array $schema)

Instruct the schema manager to record an index to be later created

public
transAlterField(string $table, string $field, string $schema)

Instruct the schema manager to record a field to be later updated

public
transAlterIndex(string $table, string $index, array $schema)

Instruct the schema manager to record an index to be later updated

protected
transInitTable(string $table)

Handler for the other transXXX methods - mark the given table as being altered if it doesn't already exist

public
requireTable(string $table, array $fieldSchema = null, array $indexSchema = null, bool $hasAutoIncPK = true, string $options = array(), array $extensions = false)

Generate the following table in the database, modifying whatever already exists as necessary.

public
dontRequireTable(string $table)

If the given table exists, move it out of the way by renaming it to obsolete(tablename).

public
requireIndex(string $table, string $index, string|array|bool $spec)

Generate the given index in the database, modifying whatever already exists as necessary.

protected
array
explodeColumnString(string $spec)

Splits a spec string safely, considering quoted columns, whitespace, and cleaning brackets

protected
string
implodeColumnList(array $columns)

Builds a properly quoted column list from an array

protected
string
quoteColumnSpecString(string $spec)

Given an index specification in the form of a string ensure that each column name is property quoted, stripping brackets and modifiers.

protected
string
determineIndexType(array|string $spec)

Given an index spec determines the index type

protected
array
parseIndexSpec($name, string|array $spec)

Converts an array or string index spec into a universally useful array

protected
convertIndexSpec(string|array $indexSpec)

This takes the index spec which has been provided by a class (ie static $indexes = blah blah) and turns it into a proper string.

public
bool
hasTable($tableName)

Returns true if the given table is exists in the current database

public
bool
hasField(string $tableName, string $fieldName)

Return true if the table exists and already has a the field specified

public
requireField(string $table, string $field, array|string $spec)

Generate the given field on the table, modifying whatever already exists as necessary.

public
dontRequireField(string $table, string $fieldName)

If the given field exists, move it out of the way by renaming it to obsolete(fieldname).

public
alterationMessage(string $message, string $type = "")

Show a message about database alteration

public
string
IdColumn(bool $asDbValue = false, bool $hasAutoIncPK = true)

This returns the data type for the id column which is the primary key for each table

public
bool
checkAndRepairTable(string $tableName)

Checks a table's integrity and repairs it if necessary.

public
array
enumValuesForField(string $tableName, string $fieldName)

Returns the values of the given enum field

public
dbDataType($type)

No description

public
array
databaseList()

Retrieves the list of all databases the user has access to

public
bool
databaseExists(string $name)

Determine if the database with the specified name exists

public
bool
createDatabase(string $name)

Create a database with the specified name

public
dropDatabase(string $name)

Drops a database with the specified name

public
alterIndex(string $tableName, string $indexName, string $indexSpec)

Alter an index on a table.

protected
string
indexKey(string $table, string $index, array $spec)

Determines the key that should be used to identify this index when retrieved from DBSchemaManager->indexList.

public
indexList(string $table)

Return the list of indexes in a table.

public
array
tableList()

Returns a list of all tables in the database.

public
string
createTable(string $table, array $fields = null, array $indexes = null, array $options = null, $advancedOptions = null)

Create a new table.

public
alterTable(string $table, array $newFields = null, array $newIndexes = null, array $alteredFields = null, array $alteredIndexes = null, array $alteredOptions = null, array $advancedOptions = null)

Alter a table's schema.

public
renameTable(string $oldTableName, string $newTableName)

Rename a table.

public
createField(string $table, string $field, string $spec)

Create a new field on a table.

public
renameField(string $tableName, string $oldName, string $newName)

Change the database column name of the given field.

public
array
fieldList(string $table)

Get a list of all the fields for the given table.

public
bool
clearCachedFieldlist(string $tableName = false)

This allows the cached values for a table's field list to be erased.

public
createPostgresDatabase(string $name)

Creates a postgres database, ignoring model_schema_as_database

public
bool
postgresDatabaseExists(string $name)

Determines if a postgres database exists, ignoring model_schema_as_database

public
array
postgresDatabaseList()

Determines the list of all postgres databases, ignoring model_schema_as_database

public
dropPostgresDatabase(string $name)

Drops a postgres database, ignoring model_schema_as_database

public
bool
schemaExists(string $name)

Returns true if the schema exists in the current database

public
createSchema(string $name)

Creates a schema in the current database

public
dropSchema(string $name)

Drops a schema from the database. Use carefully!

public
array
schemaList()

Returns the list of all available schemas on the current database

protected
string
buildPostgresIndexName(string $tableName, string $indexName, string $prefix = 'ix')

Builds the internal Postgres index name given the silverstripe table and index name

public
string
buildPostgresTriggerName(string $tableName, string $triggerName)

Builds the internal Postgres trigger name given the silverstripe table and trigger name

public
alterField(string $tableName, string $fieldName, string $fieldSpec)

Change the database type of the given field.

public
createIndex(string $tableName, string $indexName, string $indexSpec)

Create an index on a table.

protected
getIndexSqlDefinition($tableName, $indexName, $indexSpec, $asDbValue = false)

No description

protected
array
extractTriggerColumns(string $triggerName)

Given a trigger name attempt to determine the columns upon which it acts

protected
false|array
constraintExists(string $constraint, bool $cache = true)

Find out what the constraint information is, given a constraint name.

public
array
tableDetails(string $tableName)

A function to return the field names and datatypes for the particular table

protected
dropTrigger(string $triggerName, string $tableName)

Pass a legit trigger name and it will be dropped This assumes that the trigger has been named in a unique fashion

protected
array
triggerFieldsFromTrigger(string $trigger)

This will return the fields that the trigger is monitoring

public
string
boolean(array $values, bool $asDbValue = false)

Return a boolean type-formatted string

public
string
date(array $values)

Return a date type-formatted string

public
string
decimal(array $values, bool $asDbValue = false)

Return a decimal type-formatted string

public
string
enum(array $values)

Return a enum type-formatted string

public
string
float(array $values, bool $asDbValue = false)

Return a float type-formatted string

public
string
double(array $values, bool $asDbValue = false)

Return a float type-formatted string cause double is not supported

public
string
int(array $values, bool $asDbValue = false)

Return a int type-formatted string

public
string
bigint(array $values, bool $asDbValue = false)

Return a bigint type-formatted string

public
string
SS_Datetime(array $values, bool $asDbValue = false)

Return a datetime type-formatted string For PostgreSQL, we simply return the word 'timestamp', no other parameters are necessary

public
string
text(array $values, bool $asDbValue = false)

Return a text type-formatted string

public
string
time(array $values)

Return a time type-formatted string

public
string
varchar(array $values, bool $asDbValue = false)

Return a varchar type-formatted string

public
year($values, $asDbValue = false)

No description

protected
fulltext(array $this_index, string $tableName, string $name)

Create a fulltext search datatype for PostgreSQL This will also return a trigger to be applied to this table

protected
array
enumValuesFromConstraint(string $constraint)

Get the actual enum fields from the constraint value:

public
createOrReplaceTablespace($name, $location)

No description

public
createOrReplacePartition(string $tableName, array $partitions, array $indexes, array $extensions)

No description

public
createLanguage($language)

No description

public
string
set(array $values)

Return a set type-formatted string This is used for Multi-enum support, which isn't actually supported by Postgres.

Details

setDatabase(SS_Database $database)

Injector injection point for database controller

Parameters

SS_Database $database

quiet()

Enable supression of database messages.

SS_Query query(string $sql, int $errorLevel = E_USER_ERROR)

Execute the given SQL query.

This abstract function must be defined by subclasses as part of the actual implementation. It should return a subclass of SS_Query as the result.

Parameters

string $sql

The SQL query to execute

int $errorLevel

The level of error reporting to enable for the query

Return Value

SS_Query

SS_Query preparedQuery(string $sql, array $parameters, int $errorLevel = E_USER_ERROR)

Execute the given SQL parameterised query with the specified arguments

Parameters

string $sql

The SQL query to execute. The ? character will denote parameters.

array $parameters

An ordered list of arguments.

int $errorLevel

The level of error reporting to enable for the query

Return Value

SS_Query

schemaUpdate($callback)

Initiates a schema update within a single callback

Parameters

$callback

Exceptions

Exception

cancelSchemaUpdate()

Cancels the schema updates requested during (but not after) schemaUpdate() call.

bool isSchemaUpdating()

Returns true if we are during a schema update.

Return Value

bool

bool doesSchemaNeedUpdating()

Returns true if schema modifications were requested during (but not after) schemaUpdate() call.

Return Value

bool

transCreateTable(string $table, array $options = null, array $advanced_options = null)

Instruct the schema manager to record a table creation to later execute

Parameters

string $table

Name of the table

array $options

Create table options (ENGINE, etc.)

array $advanced_options

Advanced table creation options

transAlterTable(string $table, array $options, array $advanced_options)

Instruct the schema manager to record a table alteration to later execute

Parameters

string $table

Name of the table

array $options

Create table options (ENGINE, etc.)

array $advanced_options

Advanced table creation options

transCreateField(string $table, string $field, string $schema)

Instruct the schema manager to record a field to be later created

Parameters

string $table

Name of the table to hold this field

string $field

Name of the field to create

string $schema

Field specification as a string

transCreateIndex(string $table, string $index, array $schema)

Instruct the schema manager to record an index to be later created

Parameters

string $table

Name of the table to hold this index

string $index

Name of the index to create

array $schema

Already parsed index specification

transAlterField(string $table, string $field, string $schema)

Instruct the schema manager to record a field to be later updated

Parameters

string $table

Name of the table to hold this field

string $field

Name of the field to update

string $schema

Field specification as a string

transAlterIndex(string $table, string $index, array $schema)

Instruct the schema manager to record an index to be later updated

Parameters

string $table

Name of the table to hold this index

string $index

Name of the index to update

array $schema

Already parsed index specification

protected transInitTable(string $table)

Handler for the other transXXX methods - mark the given table as being altered if it doesn't already exist

Parameters

string $table

Name of the table to initialise

requireTable(string $table, array $fieldSchema = null, array $indexSchema = null, bool $hasAutoIncPK = true, string $options = array(), array $extensions = false)

Generate the following table in the database, modifying whatever already exists as necessary.

Change detection for CREATE TABLE $options other than "Engine"

Parameters

string $table

The name of the table

array $fieldSchema

A list of the fields to create, in the same form as DataObject::$db

array $indexSchema

A list of indexes to create. See requireIndex() The values of the array can be one of:

  • true: Create a single column index on the field named the same as the index.
  • array('fields' => array('A','B','C'), 'type' => 'index/unique/fulltext'): This gives you full control over the index.
bool $hasAutoIncPK

A flag indicating that the primary key on this table is an autoincrement type

string $options

SQL statement to append to the CREATE TABLE call.

array $extensions

List of extensions

dontRequireTable(string $table)

If the given table exists, move it out of the way by renaming it to obsolete(tablename).

Parameters

string $table

The table name.

requireIndex(string $table, string $index, string|array|bool $spec)

Generate the given index in the database, modifying whatever already exists as necessary.

The keys of the array are the names of the index. The values of the array can be one of:

  • true: Create a single column index on the field named the same as the index.
  • array('type' => 'index|unique|fulltext', 'value' => 'FieldA, FieldB'): This gives you full control over the index.

Parameters

string $table

The table name.

string $index

The index name.

string|array|bool $spec

The specification of the index in any loose format. See requireTable() for more information.

protected array explodeColumnString(string $spec)

Splits a spec string safely, considering quoted columns, whitespace, and cleaning brackets

Parameters

string $spec

The input index specification string

Return Value

array

List of columns in the spec

protected string implodeColumnList(array $columns)

Builds a properly quoted column list from an array

Parameters

array $columns

List of columns to implode

Return Value

string

A properly quoted list of column names

protected string quoteColumnSpecString(string $spec)

Given an index specification in the form of a string ensure that each column name is property quoted, stripping brackets and modifiers.

This index may also be in the form of a "CREATE INDEX..." sql fragment

Parameters

string $spec

The input specification or query. E.g. 'unique (Column1, Column2)'

Return Value

string

The properly quoted column list. E.g. '"Column1", "Column2"'

protected string determineIndexType(array|string $spec)

Given an index spec determines the index type

Parameters

array|string $spec

Return Value

string

protected array parseIndexSpec($name, string|array $spec)

Converts an array or string index spec into a universally useful array

Parameters

$name
string|array $spec

Return Value

array

The resulting spec array with the required fields name, type, and value

See also

convertIndexSpec() for approximate inverse

protected convertIndexSpec(string|array $indexSpec)

This takes the index spec which has been provided by a class (ie static $indexes = blah blah) and turns it into a proper string.

Some indexes may be arrays, such as fulltext and unique indexes, and this allows database-specific arrays to be created. See requireTable() for details on the index format.

Parameters

string|array $indexSpec

See also

http://dev.mysql.com/doc/refman/5.0/en/create-index.html
parseIndexSpec() for approximate inverse

bool hasTable($tableName)

Returns true if the given table is exists in the current database

Parameters

$tableName

Return Value

bool

Flag indicating existence of table

bool hasField(string $tableName, string $fieldName)

Return true if the table exists and already has a the field specified

Parameters

string $tableName
  • The table to check
string $fieldName
  • The field to check

Return Value

bool
  • True if the table exists and the field exists on the table

requireField(string $table, string $field, array|string $spec)

Generate the given field on the table, modifying whatever already exists as necessary.

Parameters

string $table

The table name.

string $field

The field name.

array|string $spec

The field specification. If passed in array syntax, the specific database driver takes care of the ALTER TABLE syntax. If passed as a string, its assumed to be prepared as a direct SQL framgment ready for insertion into ALTER TABLE. In this case you'll need to take care of database abstraction in your DBField subclass.

dontRequireField(string $table, string $fieldName)

If the given field exists, move it out of the way by renaming it to obsolete(fieldname).

Parameters

string $table
string $fieldName

alterationMessage(string $message, string $type = "")

Show a message about database alteration

Parameters

string $message

to display

string $type

one of [created|changed|repaired|obsolete|deleted|error]

string IdColumn(bool $asDbValue = false, bool $hasAutoIncPK = true)

This returns the data type for the id column which is the primary key for each table

Parameters

bool $asDbValue
bool $hasAutoIncPK

Return Value

string

bool checkAndRepairTable(string $tableName)

Checks a table's integrity and repairs it if necessary.

Parameters

string $tableName

The name of the table.

Return Value

bool

Return true if the table has integrity after the method is complete.

array enumValuesForField(string $tableName, string $fieldName)

Returns the values of the given enum field

Make a proper implementation

Parameters

string $tableName

Name of table to check

string $fieldName

name of enum field to check

Return Value

array

List of enum values

dbDataType($type)

No description

Parameters

$type

array databaseList()

Retrieves the list of all databases the user has access to

Return Value

array

List of database names

bool databaseExists(string $name)

Determine if the database with the specified name exists

Parameters

string $name

Name of the database to check for

Return Value

bool

Flag indicating whether this database exists

bool createDatabase(string $name)

Create a database with the specified name

Parameters

string $name

Name of the database to create

Return Value

bool

True if successful

dropDatabase(string $name)

Drops a database with the specified name

Parameters

string $name

Name of the database to drop

alterIndex(string $tableName, string $indexName, string $indexSpec)

Alter an index on a table.

Parameters

string $tableName

The name of the table.

string $indexName

The name of the index.

string $indexSpec

The specification of the index, see SS_Database::requireIndex() for more details.

protected string indexKey(string $table, string $index, array $spec)

Determines the key that should be used to identify this index when retrieved from DBSchemaManager->indexList.

In some connectors this is the database-visible name, in others the usercode-visible name.

Parameters

string $table
string $index
array $spec

Return Value

string

Key for this index

indexList(string $table)

Return the list of indexes in a table.

Parameters

string $table

The table name.

array tableList()

Returns a list of all tables in the database.

Keys are table names in lower case, values are table names in case that database expects.

Return Value

array

string createTable(string $table, array $fields = null, array $indexes = null, array $options = null, $advancedOptions = null)

Create a new table.

Parameters

string $table

The name of the table

array $fields

A map of field names to field types

array $indexes

A map of indexes

array $options

An map of additional options. The available keys are as follows:

  • 'MSSQLDatabase'/'MySQLDatabase'/'PostgreSQLDatabase' - database-specific options such as "engine" for MySQL.
  • 'temporary' - If true, then a temporary table will be created
$advancedOptions

Advanced creation options

Return Value

string

The table name generated. This may be different from the table name, for example with temporary tables.

alterTable(string $table, array $newFields = null, array $newIndexes = null, array $alteredFields = null, array $alteredIndexes = null, array $alteredOptions = null, array $advancedOptions = null)

Alter a table's schema.

Parameters

string $table

The name of the table to alter

array $newFields

New fields, a map of field name => field schema

array $newIndexes

New indexes, a map of index name => index type

array $alteredFields

Updated fields, a map of field name => field schema

array $alteredIndexes

Updated indexes, a map of index name => index type

array $alteredOptions
array $advancedOptions

renameTable(string $oldTableName, string $newTableName)

Rename a table.

Parameters

string $oldTableName

The old table name.

string $newTableName

The new table name.

createField(string $table, string $field, string $spec)

Create a new field on a table.

Parameters

string $table

Name of the table.

string $field

Name of the field to add.

string $spec

The field specification, eg 'INTEGER NOT NULL'

renameField(string $tableName, string $oldName, string $newName)

Change the database column name of the given field.

Parameters

string $tableName

The name of the tbale the field is in.

string $oldName

The name of the field to change.

string $newName

The new name of the field

array fieldList(string $table)

Get a list of all the fields for the given table.

Returns a map of field name => field spec.

Parameters

string $table

The table name.

Return Value

array

bool clearCachedFieldlist(string $tableName = false)

This allows the cached values for a table's field list to be erased.

If $tablename is empty, then the whole cache is erased.

Parameters

string $tableName

Return Value

bool

createPostgresDatabase(string $name)

Creates a postgres database, ignoring model_schema_as_database

Parameters

string $name

bool postgresDatabaseExists(string $name)

Determines if a postgres database exists, ignoring model_schema_as_database

Parameters

string $name

Return Value

bool

array postgresDatabaseList()

Determines the list of all postgres databases, ignoring model_schema_as_database

Return Value

array

dropPostgresDatabase(string $name)

Drops a postgres database, ignoring model_schema_as_database

Parameters

string $name

bool schemaExists(string $name)

Returns true if the schema exists in the current database

Parameters

string $name

Return Value

bool

createSchema(string $name)

Creates a schema in the current database

Parameters

string $name

dropSchema(string $name)

Drops a schema from the database. Use carefully!

Parameters

string $name

array schemaList()

Returns the list of all available schemas on the current database

Return Value

array

protected string buildPostgresIndexName(string $tableName, string $indexName, string $prefix = 'ix')

Builds the internal Postgres index name given the silverstripe table and index name

Parameters

string $tableName
string $indexName
string $prefix

The optional prefix for the index. Defaults to "ix" for indexes.

Return Value

string

The postgres name of the index

string buildPostgresTriggerName(string $tableName, string $triggerName)

Builds the internal Postgres trigger name given the silverstripe table and trigger name

Parameters

string $tableName
string $triggerName

Return Value

string

The postgres name of the trigger

alterField(string $tableName, string $fieldName, string $fieldSpec)

Change the database type of the given field.

Parameters

string $tableName

The name of the tbale the field is in.

string $fieldName

The name of the field to change.

string $fieldSpec

The new field specification

createIndex(string $tableName, string $indexName, string $indexSpec)

Create an index on a table.

Parameters

string $tableName

The name of the table.

string $indexName

The name of the index.

string $indexSpec

The specification of the index, see Database::requireIndex() for more details.

protected getIndexSqlDefinition($tableName, $indexName, $indexSpec, $asDbValue = false)

No description

Parameters

$tableName
$indexName
$indexSpec
$asDbValue

protected array extractTriggerColumns(string $triggerName)

Given a trigger name attempt to determine the columns upon which it acts

Parameters

string $triggerName

Postgres trigger name

Return Value

array

List of columns

protected false|array constraintExists(string $constraint, bool $cache = true)

Find out what the constraint information is, given a constraint name.

We also cache this result, so the next time we don't need to do a query all over again.

Parameters

string $constraint
bool $cache

Flag whether a cached version should be used. Set to false to cache bust.

Return Value

false|array

Either false, if the constraint doesn't exist, or an array with the keys conname and pg_get_constraintdef

array tableDetails(string $tableName)

A function to return the field names and datatypes for the particular table

Parameters

string $tableName

Return Value

array

List of columns an an associative array with the keys Column and DataType

protected dropTrigger(string $triggerName, string $tableName)

Pass a legit trigger name and it will be dropped This assumes that the trigger has been named in a unique fashion

Parameters

string $triggerName

Name of the trigger

string $tableName

Name of the table

protected array triggerFieldsFromTrigger(string $trigger)

This will return the fields that the trigger is monitoring

Parameters

string $trigger

Name of the trigger

Return Value

array

string boolean(array $values, bool $asDbValue = false)

Return a boolean type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string date(array $values)

Return a date type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

Return Value

string

string decimal(array $values, bool $asDbValue = false)

Return a decimal type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string enum(array $values)

Return a enum type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

Return Value

string

string float(array $values, bool $asDbValue = false)

Return a float type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string double(array $values, bool $asDbValue = false)

Return a float type-formatted string cause double is not supported

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string int(array $values, bool $asDbValue = false)

Return a int type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string bigint(array $values, bool $asDbValue = false)

Return a bigint type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string SS_Datetime(array $values, bool $asDbValue = false)

Return a datetime type-formatted string For PostgreSQL, we simply return the word 'timestamp', no other parameters are necessary

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string text(array $values, bool $asDbValue = false)

Return a text type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

string time(array $values)

Return a time type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

Return Value

string

string varchar(array $values, bool $asDbValue = false)

Return a varchar type-formatted string

Parameters

array $values

Contains a tokenised list of info about this data type

bool $asDbValue

Return Value

string

year($values, $asDbValue = false)

No description

Parameters

$values
$asDbValue

protected fulltext(array $this_index, string $tableName, string $name)

Create a fulltext search datatype for PostgreSQL This will also return a trigger to be applied to this table

Parameters

array $this_index

Index specification for the fulltext index

string $tableName
string $name

protected array enumValuesFromConstraint(string $constraint)

Get the actual enum fields from the constraint value:

Parameters

string $constraint

Return Value

array

createOrReplaceTablespace($name, $location)

No description

Parameters

$name
$location

createOrReplacePartition(string $tableName, array $partitions, array $indexes, array $extensions)

No description

Parameters

string $tableName
array $partitions
array $indexes
array $extensions

createLanguage($language)

No description

Parameters

$language

string set(array $values)

Return a set type-formatted string This is used for Multi-enum support, which isn't actually supported by Postgres.

Throws a user error to show our lack of support, and return an "int", specifically for sapphire tests that test multi-enums. This results in a test failure, but not crashing the test run.

Parameters

array $values

Contains a tokenised list of info about this data type

Return Value

string