PHP Luminova: Table Schema Definitions and Design Guidelines
Luminova’s schema builder for defining, creating, and modifying database tables.
The Luminova Database Table Schema allows developers to define database tables and their columns using an expressive, fluent syntax. It supports a wide range of data types and column modifiers, making it easy to create complex table structures.
Class Definition
- Class namespace:
Luminova\Database\Table
Constants
These constant variables allows you to easily use predefine values.
| Constant Name | Description | Value |
|---|---|---|
| DEFAULT_NONE | Default field value none. | __NONE__ |
| DEFAULT_TIMESTAMP | Default field value timestamp. | CURRENT_TIMESTAMP |
| DEFAULT_NULL | Default field value null. | NULL |
| INDEX_PRIMARY_KEY | Primary key. | PRIMARY KEY |
| INDEX_FOREIGN_KEY | Foreign key. | FOREIGN KEY |
| INDEX_UNIQUE | Unique table index. | UNIQUE |
| INDEX_DEFAULT | Indexed table index. | INDEX |
| INDEX_FULLTEXT | Fulltext table index. | FULLTEXT |
| INDEX_SPATIAL | Spatial table index. | SPATIAL |
| MYSQL | Generate schema for MySQL database. | mysql |
| SQL_SERVER | Generate schema for SQL Server database. | sql-server |
| MS_ACCESS | Generate schema for MS Access database. | ms-access |
| SQLITE | Generate schema for SQLite. | sqlite |
| ORACLE | Generate schema for Oracle database. | oracle |
| COLUMN_NAME | Replaces format to column name. | {__REPLACE_COLUMN_NAME__} |
Properties
These properties can be use to specify database type, global, session, collection, comment or type of database table creation SQL schema to generate.
database
Specify the database type to generate schema for.
public string $database = 'mysql';session
Initialize database sessions that will be created during migration.The array key as the session identifier/name while the value is the session value to apply.
/**
* @var array<string, mixed>
*/
public array $session = [];global
Initialize database globals that will be created during migration.The array key as the global identifier/name while the value is the global value to apply.
/**
* @var array<string, mixed>
*/
public array $global = [];Collation Property
Set the table collation type.
public ?string $collation = null;Charset Property
Set the database default charset.
public ?string $charset = null;Comment Property
Set the table command.
public ?string $comment = null;ifNotExists
Specify weather to use create if not exists or just create table.
public bool $ifNotExists = false;prettify
Specify if table query should be print in new line.
public bool $prettify = true;engine
Set storage engines to handle SQL operations.
public ?string $engine = null;Methods
These methods cover a wide range of database column types and useful column modifiers. To add a column, call the method corresponding to the desired data type, passing the column name as the first parameter followed by any additional required parameters (e.g., length or value) depending on the data type.
Examples
Add a column for NUMBER data type:
$table->number('product_id', 10);Add a column for GEOMETRYCOLLECTION data type:
$table->geometryCollection('geometry');constructor
Constructor to initialize the table with a name.
public function __construct(
string $tableName,
string $database = self::MYSQL,
bool $ifNotExists = false,
?string $collation = null,
?string $comment = null
)Parameters:
| Parameter | Type | Description |
|---|---|---|
$tableName | string | The name of the table. |
$database | string | The database type (default: MYSQL). |
$ifNotExists | bool | Whether to add if not exists (default: false). |
$collation | ?string | Optional table collation type (default: null). |
$comment | ?string | Optional table comment (default: null). |
Throws:
- Luminova\Exceptions\DatabaseException - If the table name is an empty string.
string
Create a new column to store string values.
string(string $name, string $type = 'VARCHAR', int|null $length = 255): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$type | string | The column data type (default VARCHAR). |
$length | int|null | (Optional) The length or size of the column (default: 255). |
Return:
self - Return table class instance.
integer
Alias for int method, to creates an INT column with optional length.
integer(string $name, ?int $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
number
Creates an NUMBER column with optional length.
number(string $name, ?int $precision = null, ?int $scale = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int|null | The optional precision length of the column (default: NULL). |
$scale | int|null | The optional scale length of the column (default: NULL). |
Return:
self - Return table class instance.
decimal
Creates a DECIMAL column with precision and scale length.
decimal(string $name, int $precision = 10, int $scale = 0): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int | The precision of the decimal (default: 10). |
$scale | int | The scale of the decimal (default: 0). |
Return:
self - Return table class instance.
float
Creates a FLOAT column with precision and scale length.
float(string $name, int $precision = 10, int $scale = 2): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int | The precision of the float (default: 10). |
$scale | int | The scale of the float (default: 2). |
Return:
self - Return table class instance.
double
Creates a DOUBLE column with precision and scale length.
double(string $name, int $precision = 10, int $scale = 2): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
text
Creates a TEXT column with optional length.
text(string $name, int|null $length = 255): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column (default: 255). |
Return:
self - Return table class instance.
date
Creates a DATE column with optional length.
date(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
enum
Creates an ENUM column with default values.
public function enum(string $name, array $values): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$values | array<array-key, mixed> | The values for the ENUM column. |
Return:
self - Return table class instance.
set
Creates a SET column with default values.
public function set(string $name, array $values): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$values | array<array-key, mixed> | The values for the SET column. |
Return:
self - Return table class instance.
id
An alias for bigInt method, to creates a primary key column id set to auto increment, BIGINT and UNSIGNED attribute.
public function id(string $name = 'id'): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | Optional column name for id (default: id). |
Return:
self - Return table class instance.
ulid
Creates a new column for ULID using CHAR(25).This method defines a column for storing ULIDs (Universally Unique Lexicographically Sortable Identifiers).
public function ulid(string $name = 'ulid'): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the ulid column (default: ulid). |
Return:
self - Return table class instance.
uuid
Creates a new column for UUID using CHAR(36).This method defines a column for storing UUIDs (Universally Unique Identifiers).
public function uuid(string $name = 'uuid'): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the UUID column (default: uuid). |
Return:
self - Return table class instance.
timestamps
Creates columns for timestamps with the names created_on and updated_on.Both columns are set to be NULLABLE with a default value of NULL.
public function timestamps(?int $precision = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$precision | ?int | Optional precision for the timestamp columns (default: NULL). |
Return:
self - Return table class instance.
Note: Trying to add other attributes to this column will not take any effect on
created_on, as it will only add toupdated_on
datetime
Creates a DATETIME column with optional precision length.
datetime(string $name, int|null $precision = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int|null | The optional precision length of the column. |
Return:
self - Return table class instance.
timestamp
Creates a TIMESTAMP column with optional precision length.
timestamp(string $name, int|null $precision = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int|null | The optional precision length of the column. |
Return:
self - Return table class instance.
time
Creates a TIME column with optional precision length.
time(string $name, int|null $precision = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int|null | The optional precision length of the column. |
Return:
self - Return table class instance.
year
Creates a YEAR column with optional precision length.
year(string $name, int|null $precision = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int|null | The optional precision length of the column. |
Return:
self - Return table class instance.
json
Creates a JSON column.
json(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
Column Modifiers
In addition to column types, you can also apply modifiers to columns to define constraints and default values. Here are the predefined modifiers.
type
Updates the column data type.Use this method to modify or specify the data type of the column if necessary.
public function type(string $type): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$type | string | The new data type for the column. |
Return:
self - Return table class instance.
attribute
Adds additional attributes to the current column.This method allows for specifying additional column attributes such as UNSIGNED, AUTO_INCREMENT, etc.
public function attribute(string $attribute): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$attribute | string | The attribute to add to the column definition. |
Return:
self - Return table class instance.
Multiple attributes can be chained together for the same column.
Example Usage
Adds the UNSIGNED and AUTO_INCREMENT attribute to the column.
$table->attribute('UNSIGNED')->attribute('AUTO_INCREMENT');entry
Define additional column entry that will be added to the table definition.
public function entry(string $query): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$query | string | The entry query string to add. |
Return:
self - Returns the table class instance.
Example Usage
This method allows adding custom column entries that will appear in the CREATE TABLE statement.
$table->entry("CONSTRAINT fk_foo_bar FOREIGN KEY (foo_id) REFERENCES bar(bar_id)");Passing fields string into the table definitions with.
$table->entry("name varchar(50) NOT NULL DEFAULT 'default value'");exec
Define additional execution constraint to execute after table creation.
public function exec(string $query): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$query | string | The execution query string to add. |
Return:
self - Returns the table class instance.
Example Usage
This method adds execution queries that will be executed after the table is created.
$table->exec("ALTER TABLE foo ADD CONSTRAINT ...");Alter column after table creation definition.
$table->exec("ALTER TABLE users MODIFY COLUMN column_name INT VISIBLE");check
Define a CHECK constraint for a column.
public function check(string $column, string $operator, string|float|int|null $value): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$column | string | The name of the column to apply the CHECK constraint on. |
$operator | string | The comparison operator for the CHECK constraint (e.g., '=', '>', '<='). |
$value | string|float|int|null | The value to compare against in the CHECK constraint. |
Return:
self - Returns the table class instance.
Example Usage
This method adds a CHECK constraint for the specified column, with an operator and value.
$table->check("column_name", ">=", 100);autoIncrement
Sets the column to auto increment.This method adds the AUTO INCREMENT attribute to an integer column,suitable for primary key columns to automatically generate unique values.
public function autoIncrement(int $start = 1, int $increment = 1): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$start | int | The starting value for the auto increment (default 1). |
$increment | int | The increment value for each auto increment step. |
Return:
self - Return table class instance.
nullable
Sets the column to nullable.This method sets the column to allow NULL values in the database.
public function nullable(bool $nullable = true): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$nullable | bool | Optional pass false for not nullable (default: true). |
Return:
self - Return table class instance.
invisible
Sets the column to invisible in MYSQL.Invisible columns are not shown in SELECT * queries but can still be accessed when explicitly specified in the query.
public function invisible(): selfReturn:
self - Return table class instance.
The
INVISIBLEattribute can only be used inMySQL 8.0.23and later.
visible
Sets the column to visible in MYSQL.This is useful for alter when column was previously set to INVISIBLE.
public function visible(): selfReturn:
self - Return table class instance.
The
VISIBLEattribute can only be used inMySQL 8.0.23and later.
default
Sets the default value for the column, optionally you can use predefine defaults Table::DEFAULT_*.This method assigns a default value to the column, which can be a string, integer, float, boolean, array, json object or null.It is often used to provide a fallback value when no explicit value is provided during record insertion.
public function default(mixed $value = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The default value for the column (default: NULL). |
Return:
self - Return table class instance.
length
Sets the precision and optional scale length for a column.
public function length(int $precision, ?int $scale = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$precision | int | The precision length of the column. |
$scale | ?int | Optional scale length of decimal, float, or double column types (default: NULL). |
Return:
self - Return table class instance.
collation
Sets the collation for column.
public function collation(string $collate): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$collate | string | The column collation to use (e.g. utf8_unicode_ci). |
Return:
self - Return table class instance.
charset
Sets the charset for column.
public function charset(string $charset): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$charset | string | The column charset to use (e.g. utf8). |
Return:
self - Return table class instance.
index
Define an index constraint on a column.This method allows you to specify various types of index constraints on a table column,such as default, unique, fulltext, spatial, or primary key.
public function index(string $index = self::INDEX_DEFAULT): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$index | string | The type of index constraint to apply (default: INDEX). |
Return:
self - Return table class instance.
Throws:
- Luminova\Exceptions\DatabaseException - If an unsupported index type is provided.
Constants Index Types:
Table::INDEX_DEFAULT: Creates a standard index on the column.Table::INDEX_UNIQUE: Creates a unique index on the column.Table::INDEX_FULLTEXT: Creates a fulltext index on the column (MySQL specific).Table::INDEX_SPATIAL: Creates a spatial index on the column (MySQL specific).Table::INDEX_PRIMARY_KEY: Sets the column as a primary key.
defaultIndex
Sets a column index as INDEX (e.g., column_name INDEX).This method adds a regular index to the column, optimizing data retrieval and query performance.
public function defaultIndex(?string $columns = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$columns | ?string | The column names to apply the index on, separated by commas (e.g., column1,column2) (optional). |
Return:
self - Returns the table class instance.
fullText
Sets a column index as FULLTEXT (e.g., column_name FULLTEXT INDEX).This method specifies that the column is optimized for full-text searches, allowing efficient keyword-based searching of text within the column.
public function fullText(?string $columns = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$columns | ?string | The column names to apply the index on, separated by commas (e.g., column1,column2) (optional). |
Return:
self - Return table class instance.
spatial
Sets a column index as SPATIAL (e.g., column_name SPATIAL INDEX).This method specifies that the column is used for spatial data types, enabling efficient querying of spatial data like points, lines, and polygons.
public function spatial(?string $columns = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$columns | ?string | The column names to apply the index on, separated by commas (e.g., column1,column2) (optional). |
Return:
self - Return table class instance.
unique
Sets a column as a UNIQUE key inline with the column definition (e.g., column_name UNIQUE INDEX).This method specifies that the column must contain unique values across all rows in the table.
public function unique(?string $columns = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$columns | ?string | The column names to apply the index on, separated by commas (e.g., column1,column2) (optional). |
Return:
self - Return table class instance.
primary
Sets the column as PRIMARY KEY.This method designates the column as the primary key of the table, ensuring each row is uniquely identified by its values in this column.
public function primary(bool $constraint = false): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$constraint | bool | Whether to use a primary key constraint (default: false). |
Return:
self - Return table class instance.
Throws:
- Luminova\Exceptions\DatabaseException - If attempting to add a primary key constraint while multiple columns are already designated as primary key.
*Example Usages:
Sets column as primary key: PRIMARY KEY (column_name).
$table->primary();Sets column as primary key constraint: CONSTRAINT pk_table_name PRIMARY KEY (column_name).
$table->primary(true);foreign
Define a foreign key relationship.
public function foreign(string $table, string $column, bool $constraint = false): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$table | string | The name of the referenced table. |
$column | string | The column in the referenced table. |
$constraint | bool | Whether to include a named constraint (default: false). |
Return:
self - Returns the table class instance.
unsigned
Add UNSIGNED attribute to a column definition.For non-MySQL databases, a CHECK (column >= 0) constraint is used to enforce non-negative values.
public function unsigned(): selfReturn:
self - Return table class instance.
comment
Sets a comment for the column.
public function comment(string $comment): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$comment | string | The comment to set. |
Return:
self - Return table class instance.
virtual
Define a VIRTUAL generated column.
public function virtual(string $expression): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$expression | string | The SQL expression defining the column's value. |
Return:
self - Return table class instance.
*Example Usages:
This would create a virtual generated column that concatenates first_name and last_name.
$table->virtual("CONCAT(first_name, ' ', last_name)");This would create a virtual generated column that computes quantity * price.
$table->virtual("quantity * price");This would create a virtual generated column in Oracle that concatenates first_name and last_name.
$table->virtual("first_name || ' ' || last_name");stored
Define a STORED generated column.
public function stored(string $expression): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$expression | string | The SQL expression defining the column's value. |
Return:
self - Returns the table class instance.
*Example Usages:
This would create a stored generated column that concatenates first_name and last_name.
$table->stored("CONCAT(first_name, ' ', last_name)");This would create a stored generated column that computes quantity * price.
$table->stored("quantity * price");mediaType
Sets the media type for the column.
public function mediaType(string $type): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$type | string | The media type to set. |
Return:
self - Return table class instance.
browserDisplay
Sets browser display transformation for the column.
public function browserDisplay(string $type, ?array $option = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$type | string | The transformation type. |
$option | ?array<array-key,mixed> | Optional transformation option. |
Return:
self - Return table class instance.
inputTransformation
Sets input transformation for the column.
public function inputTransformation(string $type, ?array $option = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$type | string | The transformation type. |
$option | ?array<array-key,mixed> | Optional transformation option. |
Return:
self - Return table class instance.
first
Reorder column at the beginning.
public function first(): selfReturn:
self - Return table class instance.
after
Reorder column after a specific column name.
public function after(string $column): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$column | string | The column name to move after it. |
Return:
self - Return table class instance.
Other Column Data Type Methods
These methods are used to add other types of column data types, with names derived from the corresponding SQL data types they represent.
varchar
Creates a VARCHAR column with optional length.
varchar(string $name, int|null $length = 255): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column (default: 255). |
Return:
self - Return table class instance.
tinyInt
Creates a TINYINT column with optional length.
tinyInt(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
smallInt
Creates a SMALLINT column with optional length.
smallInt(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
mediumInt
Creates a MEDIUMINT column with optional length.
mediumInt(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
bigInt
Creates a BIGINT column with optional length.
bigInt(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$precision | int | The precision of the double (default: 10). |
$scale | int | The scale of the double (default: 2). |
Return:
self - Return table class instance.
real
Creates a REAL column with optional length.
real(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
bit
Creates a BIT column with optional length.
bit(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
boolean
Creates a BOOLEAN column, a synonym for TINYINT(1).
boolean(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
serial
Creates a SERIAL column, an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
serial(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
char
Creates a CHAR column with optional length.
char(string $name, int|null $length = 255): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column (default: 255). |
Return:
self - Return table class instance.
tinyText
Creates a TINYTEXT column.
tinyText(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
mediumText
Creates a MEDIUMTEXT column.
mediumText(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
longText
Creates a LONGTEXT column.
longText(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
binary
Creates a BINARY column with optional length.
binary(string $name, int|null $length = 255): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column (default: 255). |
Return:
self - Return table class instance.
varBinary
Creates a VARBINARY column with optional length.
varBinary(string $name, int|null $length = 255): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column (default: 255). |
Return:
self - Return table class instance.
tinyBlob
Creates a TINYBLOB column with optional length.
tinyBlob(string $name, int|null $length = null): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
$length | int|null | The optional length of the column. |
Return:
self - Return table class instance.
blob
Creates a BLOB column.
blob(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
mediumBlob
Creates a MEDIUMBLOB column.
mediumBlob(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
longBlob
Creates a LONGBLOB column.
longBlob(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
geometry
Creates a GEOMETRY column.
geometry(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
point
Creates a POINT column.
point(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
lineString
Creates a LINESTRING column.
lineString(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
polygon
Creates a POLYGON column.
polygon(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
multiPoint
Creates a MULTIPOINT column.
multiPoint(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
multiLineString
Creates a MULTILINESTRING column.
multiLineString(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
multiPolygon
Creates a MULTIPOLYGON column.
multiPolygon(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
geometryCollection
Creates a GEOMETRYCOLLECTION column.
geometryCollection(string $name): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the column. |
Return:
self - Return table class instance.
extra
Define an extra column options that will be added to the table definition.
public function extra(string $query): selfParameters:
| Parameter | Type | Description |
|---|---|---|
$query | string | The entry query string to add. |
Return:
self - Returns the table class instance.