firfuorida  0.0.1
Qt based database migration library
Public Member Functions | List of all members
Firfuorida::Table Class Reference

Contains information about a single table, either to create or to modify. More...

#include <Firfuorida/Table>

Inheritance diagram for Firfuorida::Table:
Inheritance graph
[legend]

Public Member Functions

 ~Table () override
 Deconstructs the Table object. More...
 
ColumnbigIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned big integer primary key column that auto increments with given columnName and returns a pointer to the Column object. More...
 
ColumnbigInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed big integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
Columnbinary (const QString &columnName, uint length=255)
 Creates/modifies a binary column with given columnName and length and returns a pointer to the Column object. More...
 
Columnbit (const QString &columnName, uint length)
 Creates/modifies a bit column with given columnName and length and returns a pointer to the Column object. More...
 
Columnblob (const QString &columnName)
 Creates/modifies a blob column with given columnName and returns a pointer to the Column object. More...
 
Columnboolean (const QString &columnName)
 Creates/modifies a boolean column with given columnName and returns a pointer to the Column object. More...
 
ColumncharCol (const QString &columnName, uint length=255)
 Creates/modifies a char column with given columnName and length and returns a pointer to the Column object. More...
 
Columndate (const QString &columnName)
 Creates/modifies a date column with given columnName and returns a pointer to the Column object. More...
 
ColumndateTime (const QString &columnName)
 Creates/modifies a datetime column with given columnName and returns a pointer to the Column object. More...
 
Columndecimal (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed decimal column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
ColumndoubleCol (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed double column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
void dropColumn (const QString &columnName)
 Drops the column identfied by columnName from the table. More...
 
ColumnenumCol (const QString &columnName, const QStringList &enums)
 Creates/modifies an enum column with given columnName and enums and returns a pointer to the Column object. More...
 
ColumnfloatCol (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed float column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
ColumnforeignKey (const QStringList &foreignKeys, const QString &referenceTable, const QStringList &referenceCols, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a foreign key constraint for foreignKeys that references the referenceCols at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior. More...
 
ColumnforeignKey (const QString &foreignKeyCol, const QString &referenceTable, const QString &referenceCol, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a foreign key constraint for foreignKey that references the referenceCol at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior. More...
 
Columnincrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned integer primary key column that auto increments with given columnName and returns a pointer to the Column object. More...
 
Columnindex (const QStringList &cols, const QString &indexName=QString())
 Creates/modifies an index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future. More...
 
Columnindex (const QString &col, const QString &indexName=QString())
 Creates/modifies an index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future. More...
 
Columninteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
Columnjson (const QString &columnName)
 Creates/modifies a JSON column with given columnName and returns a pointer to the Column object. More...
 
Columnkey (const QStringList &cols, const QString &indexName=QString())
 Creates/modifies a key index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future. More...
 
Columnkey (const QString &col, const QString &indexName=QString())
 Creates/modifies a key index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future. More...
 
ColumnlongBlob (const QString &columnName)
 Creates/modifies a long blob column with given columnName and returns a pointer to the Column object. More...
 
ColumnlongText (const QString &columnName)
 Creates/modifies a long text column with given columnName and returns a pointer to the Column object. More...
 
ColumnmediumBlob (const QString &columnName)
 Creates/modifies a medium blob column with given columnName and returns a pointer to the Column object. More...
 
ColumnmediumIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned medium integer primary key column that auto increments with given columnName and returns a pointer to the Column object. More...
 
ColumnmediumInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed medium integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
ColumnmediumText (const QString &columnName)
 Creates/modifies a medium text column with given columnName and returns a pointer to the Column object. More...
 
Columnnumeric (const QString &columnName, uint precision, uint scale)
 Creates/modifies a signed numeric column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
ColumnprimaryKey (const QStringList &cols, const QString &constraintSymbol=QString())
 Creates/modifies a primary key index over the columns cols named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future. More...
 
ColumnprimaryKey (const QString &col, const QString &constraintSymbol=QString())
 Creates/modifies a primary key index for col named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future. More...
 
Columnset (const QString &columnName, const QStringList &setList)
 Creates/modifies a set column with given columnName and setList and returns a pointer to the Column object. More...
 
void setCharset (const QString &charset)
 Set the default charset when creating a new table or change it for an existing table. More...
 
void setCollation (const QString &collation)
 Set the collation when creating a new table or change it for an existing table. More...
 
void setComment (const QString &comment)
 Sets a comment when creating a new table of change it for an existing table. More...
 
void setEngine (const QString &engine)
 Set the used engine when creating a new table or change it for an existing table. More...
 
void setIsTemporary (bool isTemporary=true)
 Marks the table as temporary if isTemporary is set to true. More...
 
ColumnsmallIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned small integer primary key column that auto increments with given columnName and returns a pointer to the Column object. More...
 
ColumnsmallInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed small integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
Columntext (const QString &columnName)
 Creates/modifies a text column with given columnName and returns a pointer to the Column object. More...
 
Columntime (const QString &columnName)
 Creates/modifies a time column with given columnName and returns a pointer to the Column object. More...
 
Columntimestamp (const QString &columnName)
 Creates/modifies a timestamp column with given columnName and returns a pointer to the Column object. More...
 
ColumntinyBlob (const QString &columnName)
 Creates/modifies a tiny blob column with given columnName and returns a pointer to the Column object. More...
 
ColumntinyIncrements (const QString &columnName=QStringLiteral("id"))
 Creates/modifies an unsigned tiny integer primary key column that auto increments with given columnName and returns a pointer to the Column object. More...
 
ColumntinyInteger (const QString &columnName, uint displayWidth=0)
 Creates/modifies a signed tiny integer column with given columnName and displayWidth displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned. More...
 
ColumntinyText (const QString &columnName)
 Creates/modifies a tiny text column with given columnName and returns a pointer to the Column object. More...
 
ColumnuniqueIndex (const QStringList &cols, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. More...
 
ColumnuniqueIndex (const QString &col, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. More...
 
ColumnuniqueKey (const QStringList &cols, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique key index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. More...
 
ColumnuniqueKey (const QString &col, const QString &constraintSymbol=QString(), const QString &indexName=QString())
 Creates/modifies a unique key index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. More...
 
ColumnvarBinary (const QString &columnName, uint length=255)
 Creates/modifies a varbinary column with given columnName and length and returns a pointer to the Column object. More...
 
ColumnvarChar (const QString &columnName, uint length=255)
 Creates/modifies a varchar column with given columnName and length and returns a pointer to the Column object. More...
 
Columnyear (const QString &columnName)
 Creates/modifies a year column with given columnName and returns a pointer to the Column object. More...
 

Detailed Description

Contains information about a single table, either to create or to modify.

The Table object can only be created by functions of the Migration class.

Example

example.h

/*
* SPDX-FileCopyrightText: (C) 2019-2022 Matthias Fehring <https://www.huessenbergnetz.de>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include <Firfuorida/Migration>
class M20190121T174100_Example : public Firfuorida::Migration
{
public:
explicit M20190121T174100_Example(Firfuorida::Migrator *parent);
~M20190121T174100_Example() override;
protected:
void up() override;
void down() override;
}

example.cpp

/*
* SPDX-FileCopyrightText: (C) 2019-2022 Matthias Fehring <https://www.huessenbergnetz.de>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include "example.h"
M20190121T174100_Example::M20190121T174100_Example(Firfuorida::Migrator *parent) :
Firefuorida::Migration(parent)
{
}
M20190121T174100_Example::~M20190121T174100_Example()
{
}
void M20190121T174100_Example::up()
{
// create a new table named "ExampleTable" if it not already exists
auto t = createTableIfNotExists(QStringLiteral("ExampleTable"));
// create a new unsigned tiny integer column on that table with the
// default name "id" and auto incrementation enabled
t->tinyIncrements();
// create a new signed tiny integer column on that table with the
// name "tinyIntCol" and UNIQUE KEY index.
t->tinyInteger(QStringLiteral("tinyIntCol"))->unique();
// create a new nullable tiny blob column on that table with the name
// "tinyBlobCol"
t->tinyBlob(QStringLiteral("tinyBlobCol"))->nullable();
// create a new tiny text column on that table with the name "tinyTextCol"
// and the default value "foobar"
t->tinyText(QStringLiteral("tinyTextCol"))->defaultValue(QStringLiteral("foobar"));
}
void M20190121T174100_Example::down()
{
// drop the table named "ExampleTable" if it exists
dropIfExists(QStringLiteral("ExampleTable"));
}

Constructor & Destructor Documentation

◆ ~Table()

Table::~Table ( )
override

Deconstructs the Table object.

Member Function Documentation

◆ bigIncrements()

Column * Table::bigIncrements ( const QString columnName = QStringLiteral("id"))

Creates/modifies an unsigned big integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ bigInteger()

Column * Table::bigInteger ( const QString columnName,
uint  displayWidth = 0 
)

Creates/modifies a signed big integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName BIGINT(displayWidth}

◆ binary()

Column * Table::binary ( const QString columnName,
uint  length = 255 
)

Creates/modifies a binary column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName BINARY(\a length)

◆ bit()

Column * Table::bit ( const QString columnName,
uint  length 
)

Creates/modifies a bit column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName BIT

◆ blob()

Column * Table::blob ( const QString columnName)

Creates/modifies a blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName BLOB

◆ boolean()

Column * Table::boolean ( const QString columnName)

Creates/modifies a boolean column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYINT(1)

◆ charCol()

Column * Table::charCol ( const QString columnName,
uint  length = 255 
)

Creates/modifies a char column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName CHAR(length)

◆ date()

Column * Table::date ( const QString columnName)

Creates/modifies a date column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName DATE

◆ dateTime()

Column * Table::dateTime ( const QString columnName)

Creates/modifies a datetime column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName DATETIME

◆ decimal()

Column * Table::decimal ( const QString columnName,
uint  precision,
uint  scale 
)

Creates/modifies a signed decimal column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName DECIMAL(precision, scale)

◆ doubleCol()

Column * Table::doubleCol ( const QString columnName,
uint  precision,
uint  scale 
)

Creates/modifies a signed double column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName DOUBLE(precision, scale)

◆ dropColumn()

void Table::dropColumn ( const QString columnName)

Drops the column identfied by columnName from the table.

◆ enumCol()

Column * Table::enumCol ( const QString columnName,
const QStringList enums 
)

Creates/modifies an enum column with given columnName and enums and returns a pointer to the Column object.

MySQL statement
columnName ENUM('enum1', 'enum2')

◆ floatCol()

Column * Table::floatCol ( const QString columnName,
uint  precision,
uint  scale 
)

Creates/modifies a signed float column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName FLOAT(precision, scale)

◆ foreignKey() [1/2]

Column * Table::foreignKey ( const QStringList foreignKeys,
const QString referenceTable,
const QStringList referenceCols,
const QString constraintSymbol = QString(),
const QString indexName = QString() 
)

Creates/modifies a foreign key constraint for foreignKeys that references the referenceCols at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior.

Example
table->foreignKey(QStringList({"col1","col2"}), QStringLiteral("referenceTable"), QStringList({"refCol1","refCol2"}))->onDelete(QStringLiteral("CASCADE"))->onUpdate(QStringLiteral("CASCADE"));
MySQL statement
[CONSTRAINT constraintSymbol] FOREIGN KEY [indexName] (col1,col2) REFERENCES referenceTable (refCol1,refCol2) ON DELETE CASCADE ON UPDATE CASCADE

◆ foreignKey() [2/2]

Column * Table::foreignKey ( const QString foreignKeyCol,
const QString referenceTable,
const QString referenceCol,
const QString constraintSymbol = QString(),
const QString indexName = QString() 
)

Creates/modifies a foreign key constraint for foreignKey that references the referenceCol at referenceTable and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future. Use Column:onDelete() and/or Column::onUpdate() on the returned Column object to set reference behavior.

Example
table->foreignKey(QStringLiteral("col"), QStringLiteral("referenceTable"), QStringLiteral("refCol"))->onDelete(QStringLiteral("CASCADE"))->onUpdate(QStringLiteral("CASCADE"));
MySQL statement
[CONSTRAINT constraintSymbol] FOREIGN KEY [indexName] (col) REFERENCES referenceTable (refCol) ON DELETE CASCADE ON UPDATE CASCADE

◆ increments()

Column * Table::increments ( const QString columnName = QStringLiteral("id"))

Creates/modifies an unsigned integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName INT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ index() [1/2]

Column * Table::index ( const QStringList cols,
const QString indexName = QString() 
)

Creates/modifies an index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col1,col2)

◆ index() [2/2]

Column * Table::index ( const QString col,
const QString indexName = QString() 
)

Creates/modifies an index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col)

◆ integer()

Column * Table::integer ( const QString columnName,
uint  displayWidth = 0 
)

Creates/modifies a signed integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName INT(displayWidth}

◆ json()

Column * Table::json ( const QString columnName)

Creates/modifies a JSON column with given columnName and returns a pointer to the Column object.

Note
On some RDBMS like MariaDB and SQLite, the JSON data type is an alias for a text type.
MySQL statement
columnName JSON

◆ key() [1/2]

Column * Table::key ( const QStringList cols,
const QString indexName = QString() 
)

Creates/modifies a key index over the columns cols named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col1,col2)

◆ key() [2/2]

Column * Table::key ( const QString col,
const QString indexName = QString() 
)

Creates/modifies a key index for col named indexName and returns a pointer to the Column object. The indexName is optional but helps to identify the index in the future.

MySQL statement
KEY [indexName] (col)

◆ longBlob()

Column * Table::longBlob ( const QString columnName)

Creates/modifies a long blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName LONGBLOB

◆ longText()

Column * Table::longText ( const QString columnName)

Creates/modifies a long text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName LONGTEXT

◆ mediumBlob()

Column * Table::mediumBlob ( const QString columnName)

Creates/modifies a medium blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName MEDIUMBLOB

◆ mediumIncrements()

Column * Table::mediumIncrements ( const QString columnName = QStringLiteral("id"))

Creates/modifies an unsigned medium integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName MEDIUMINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ mediumInteger()

Column * Table::mediumInteger ( const QString columnName,
uint  displayWidth = 0 
)

Creates/modifies a signed medium integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName MEDIUMINT(displayWidth}

◆ mediumText()

Column * Table::mediumText ( const QString columnName)

Creates/modifies a medium text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName MEDIUMTEXT

◆ numeric()

Column * Table::numeric ( const QString columnName,
uint  precision,
uint  scale 
)

Creates/modifies a signed numeric column with given columnName, precision and scale and returns a pointer to the Column object. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName NUMERIC(precision, scale)

◆ primaryKey() [1/2]

Column * Table::primaryKey ( const QStringList cols,
const QString constraintSymbol = QString() 
)

Creates/modifies a primary key index over the columns cols named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] PRIMARY KEY (col1,col2)

◆ primaryKey() [2/2]

Column * Table::primaryKey ( const QString col,
const QString constraintSymbol = QString() 
)

Creates/modifies a primary key index for col named constraintSymbol and returns a pointer to the Column object. The constraintSymbol is optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] PRIMARY KEY (col)

◆ set()

Column * Table::set ( const QString columnName,
const QStringList setList 
)

Creates/modifies a set column with given columnName and setList and returns a pointer to the Column object.

MySQL statement
columnName SET('entry1', 'entry2')

◆ setCharset()

void Table::setCharset ( const QString charset)

Set the default charset when creating a new table or change it for an existing table.

◆ setCollation()

void Table::setCollation ( const QString collation)

Set the collation when creating a new table or change it for an existing table.

◆ setComment()

void Table::setComment ( const QString comment)

Sets a comment when creating a new table of change it for an existing table.

Note
The maximum size for a column comment on MySQL/MariaDB is 2048 characters.

◆ setEngine()

void Table::setEngine ( const QString engine)

Set the used engine when creating a new table or change it for an existing table.

◆ setIsTemporary()

void Table::setIsTemporary ( bool  isTemporary = true)

Marks the table as temporary if isTemporary is set to true.

◆ smallIncrements()

Column * Table::smallIncrements ( const QString columnName = QStringLiteral("id"))

Creates/modifies an unsigned small integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ smallInteger()

Column * Table::smallInteger ( const QString columnName,
uint  displayWidth = 0 
)

Creates/modifies a signed small integer column with given columnName and displayWidth and returns a pointer to the Column object. displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName SMALLINT(displayWidth}

◆ text()

Column * Table::text ( const QString columnName)

Creates/modifies a text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TEXT

◆ time()

Column * Table::time ( const QString columnName)

Creates/modifies a time column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TIME

◆ timestamp()

Column * Table::timestamp ( const QString columnName)

Creates/modifies a timestamp column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TIMESTAMP

◆ tinyBlob()

Column * Table::tinyBlob ( const QString columnName)

Creates/modifies a tiny blob column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYBLOB

◆ tinyIncrements()

Column * Table::tinyIncrements ( const QString columnName = QStringLiteral("id"))

Creates/modifies an unsigned tiny integer primary key column that auto increments with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY

◆ tinyInteger()

Column * Table::tinyInteger ( const QString columnName,
uint  displayWidth = 0 
)

Creates/modifies a signed tiny integer column with given columnName and displayWidth displayWidth will only be set if greate than 0. Use Column::unsigned() on the returned Column object to make the column unsigned.

MySQL statement
columnName TINYINT(displayWidth}

◆ tinyText()

Column * Table::tinyText ( const QString columnName)

Creates/modifies a tiny text column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName TINYTEXT

◆ uniqueIndex() [1/2]

Column * Table::uniqueIndex ( const QStringList cols,
const QString constraintSymbol = QString(),
const QString indexName = QString() 
)

Creates/modifies a unique index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col1,col2)

◆ uniqueIndex() [2/2]

Column * Table::uniqueIndex ( const QString col,
const QString constraintSymbol = QString(),
const QString indexName = QString() 
)

Creates/modifies a unique index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col)

◆ uniqueKey() [1/2]

Column * Table::uniqueKey ( const QStringList cols,
const QString constraintSymbol = QString(),
const QString indexName = QString() 
)

Creates/modifies a unique key index over the columns cols with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col1,col2)

◆ uniqueKey() [2/2]

Column * Table::uniqueKey ( const QString col,
const QString constraintSymbol = QString(),
const QString indexName = QString() 
)

Creates/modifies a unique key index for col with constraintSymbol named indexName and returns a pointer to the Column object. constraintSymbol and indexName are optional but helps to identify the index in the future.

MySQL statement
[CONSTRAINT constraintSymbol] UNIQUE KEY [indexName] (col)

◆ varBinary()

Column * Table::varBinary ( const QString columnName,
uint  length = 255 
)

Creates/modifies a varbinary column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName VARBINARY(length)

◆ varChar()

Column * Table::varChar ( const QString columnName,
uint  length = 255 
)

Creates/modifies a varchar column with given columnName and length and returns a pointer to the Column object.

MySQL statement
columnName VARCHAR(length)

◆ year()

Column * Table::year ( const QString columnName)

Creates/modifies a year column with given columnName and returns a pointer to the Column object.

MySQL statement
columnName YEAR