Constructor
new Structure()
Methods
bigint(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'bigint' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 255 | Min 1, Max 255. Defaults to 255 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
binary(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'binary' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 1 | Length of data. Min 1 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
bit(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'bit' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 1 | Min 1, Max 64. Default to 1 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
blob(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'blob' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 65535 | Size in bytes. Min 1, Max 65535. Defaults to 65535 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
bool(name, optionsopt) → {this}
Adds a new column of data type 'bool' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
char(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'char' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 1 | Length of characters. Min 0, Max 255. Default 1 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
date(name, optionsopt) → {this}
Adds a new column of data type 'date' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
datetime(name, fspopt, optionsopt) → {this}
Adds a new column of data type 'datetime' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
fsp | Number | <optional> | 0 | Fractional second precision. Min 0, Max 6. Defaults to 0 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
decimal(name, sizeopt, dopt, optionsopt) → {this}
Adds a new column of data type 'decimal' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 10 | Min 1, Max 65. Defaults to 10 |
d | Number | <optional> | 0 | Double precision. Min 0. Defaults to 0. |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
double(name, sizeopt, dopt, optionsopt) → {this}
Adds a new column of data type 'double' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 16 | Min 1. Defaults to 16 |
d | Number | <optional> | 8 | Double precision. Min 1. Defaults to 8 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
drop(name) → {this}
Drops (Removes) a column name
Parameters:
| Name | Type | Description |
|---|---|---|
name | String | The name of the column |
Returns:
- Type:
- this
enum(name, vals, optionsopt) → {this}
Adds a new column of data type 'enum' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
vals | Array.<String> | Array of possible values | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
float(name, popt, optionsopt) → {this}
Adds a new column of data type 'float' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
p | Number | <optional> | 25 | Precision. Min 1, Max 53. Defaults to 25 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
get() → {Array.<ColumnStructure>}
Returns the columns
Returns:
- Type:
- Array.<ColumnStructure>
int(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'int' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 255 | Min 1, Max 255. Defaults to 255 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
longblob(name, optionsopt) → {this}
Adds a new column of data type 'longblob' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
longtext(name, optionsopt) → {this}
Adds a new column of data type 'longtext' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
mediumint(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'mediumint' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 255 | Min 1, Max 255. Defaults to 255 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
mediumtext(name, optionsopt) → {this}
Adds a new column of data type 'mediumtext' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
set(name, vals, optionsopt) → {this}
Adds a new column of data type 'enum' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
vals | Array.<String> | Array of possible values | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
smallint(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'smallint' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 255 | Min 1, Max 255. Defaults to 255 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
text(name, optionsopt) → {this}
Adds a new column of data type 'text' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
time(name, fspopt, optionsopt) → {this}
Adds a new column of data type 'time' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
fsp | Number | <optional> | 0 | Fractional second precision. Min 0, Max 6. Defaults to 0 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
timestamp(name, fspopt, optionsopt) → {this}
Adds a new column of data type 'timestamp' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
fsp | Number | <optional> | 0 | Fractional second precision. Min 0, Max 6. Defaults to 0 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
tinyblob(name, optionsopt) → {this}
Adds a new column of data type 'tinyblob' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
tinyint(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'tinyint' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 255 | Min 1, Max 255. Defaults to 255 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
tinytext(name, optionsopt) → {this}
Adds a new column of data type 'tinytext' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
varbinary(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'varbinary' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 1 | Length of data. Min 1 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
varchar(name, sizeopt, optionsopt) → {this}
Adds a new column of data type 'varchar' to this structure
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | String | Name of the column | ||
size | Number | <optional> | 8 | Length of characters. Min 0, Max 255. Default 1 |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this
year(name, optionsopt) → {this}
Adds a new column of data type 'year' to this structure
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name | String | Name of the column | |
options | ConstraintOptions | <optional> | Extra constraint options |
Returns:
- Type:
- this