Declaring table structures

In certain cases, particularly for plugins which add tables into the database, or add columns into a table, it is necessary to declare the SQL structure of the table, since it is based on these declarations that SPIP constructs its queries to create or update the tables.

SPIP will therefore attempt to modify the declaration to the database manager being used, by converting certain syntax that is particular to MySQL.

As such, if you declare a table with an "auto-increment" on the primary key as proscribed by SPIP (as in ecrire/base/serial.php and ecrire/base/auxiliaires.php by using the SPIP 2 specific pipelines declarer_tables_principales and declarer_tables_auxiliaires, SPIP will then translate the "auto-increment" syntax so that it is appropriately accommodated when using PostGres or SQLite.

In the same fashion, a declaration for an "ENUM" field specific to MySQL will have the same functionality under PG or SQLite. The inverse, on the other hand, is not true (PostGres specific declarations will not be understood by the other databases).

Author Mark Baber Published : Updated : 12/05/17

Translations : English, Español, français