Structure

Creates a new table-structure

Constructor

new Structure()

Methods

bigint(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'bigint' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
255Min 1, Max 255. Defaults to 255
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

binary(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'binary' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
1Length of data. Min 1
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

bit(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'bit' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
1Min 1, Max 64. Default to 1
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

blob(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'blob' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
65535Size in bytes. Min 1, Max 65535. Defaults to 65535
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

bool(name, optionsopt) → {this}

Adds a new column of data type 'bool' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

char(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'char' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
1Length of characters. Min 0, Max 255. Default 1
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

date(name, optionsopt) → {this}

Adds a new column of data type 'date' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

datetime(name, fspopt, optionsopt) → {this}

Adds a new column of data type 'datetime' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
fspNumber<optional>
0Fractional second precision. Min 0, Max 6. Defaults to 0
optionsConstraintOptions<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:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
10Min 1, Max 65. Defaults to 10
dNumber<optional>
0Double precision. Min 0. Defaults to 0.
optionsConstraintOptions<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:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
16Min 1. Defaults to 16
dNumber<optional>
8Double precision. Min 1. Defaults to 8
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

drop(name) → {this}

Drops (Removes) a column name
Parameters:
NameTypeDescription
nameStringThe name of the column
Returns:
Type: 
this

enum(name, vals, optionsopt) → {this}

Adds a new column of data type 'enum' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
valsArray.<String>Array of possible values
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

float(name, popt, optionsopt) → {this}

Adds a new column of data type 'float' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
pNumber<optional>
25Precision. Min 1, Max 53. Defaults to 25
optionsConstraintOptions<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:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
255Min 1, Max 255. Defaults to 255
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

longblob(name, optionsopt) → {this}

Adds a new column of data type 'longblob' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

longtext(name, optionsopt) → {this}

Adds a new column of data type 'longtext' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

mediumint(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'mediumint' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
255Min 1, Max 255. Defaults to 255
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

mediumtext(name, optionsopt) → {this}

Adds a new column of data type 'mediumtext' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

set(name, vals, optionsopt) → {this}

Adds a new column of data type 'enum' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
valsArray.<String>Array of possible values
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

smallint(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'smallint' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
255Min 1, Max 255. Defaults to 255
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

text(name, optionsopt) → {this}

Adds a new column of data type 'text' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

time(name, fspopt, optionsopt) → {this}

Adds a new column of data type 'time' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
fspNumber<optional>
0Fractional second precision. Min 0, Max 6. Defaults to 0
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

timestamp(name, fspopt, optionsopt) → {this}

Adds a new column of data type 'timestamp' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
fspNumber<optional>
0Fractional second precision. Min 0, Max 6. Defaults to 0
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

tinyblob(name, optionsopt) → {this}

Adds a new column of data type 'tinyblob' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

tinyint(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'tinyint' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
255Min 1, Max 255. Defaults to 255
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

tinytext(name, optionsopt) → {this}

Adds a new column of data type 'tinytext' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

varbinary(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'varbinary' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
1Length of data. Min 1
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

varchar(name, sizeopt, optionsopt) → {this}

Adds a new column of data type 'varchar' to this structure
Parameters:
NameTypeAttributesDefaultDescription
nameStringName of the column
sizeNumber<optional>
8Length of characters. Min 0, Max 255. Default 1
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this

year(name, optionsopt) → {this}

Adds a new column of data type 'year' to this structure
Parameters:
NameTypeAttributesDescription
nameStringName of the column
optionsConstraintOptions<optional>
Extra constraint options
Returns:
Type: 
this