|
firfuorida
0.0.1
Qt based database migration library
|
Contains a single migration instance. More...
#include <Firfuorida/Migration>

Public Member Functions | |
| Migration (Migrator *parent) | |
| Constructs a new Migration object with the given parent. More... | |
| ~Migration () override | |
| Deconstructs the Migration object. More... | |
Protected Member Functions | |
| Table * | create (const QString &tableName) |
| Creates a new table with the given tableName. More... | |
| Table * | createTableIfNotExists (const QString &tableName) |
| Creates a new table with the given tableName if it not exists already. More... | |
| Migrator::DatabaseFeatures | dbFeatures () const |
| Returns features supported by the used datbase system. More... | |
| Migrator::DatabaseType | dbType () const |
| Returns the type of the used database system. More... | |
| QString | dbTypeToStr () const |
| Returns the name of the used database system. More... | |
| QVersionNumber | dbVersion () const |
| Returns the version of the used database system. More... | |
| virtual void | down ()=0 |
| Reimplement this function to perform database operations when performing migration rollback. More... | |
| void | drop (const QString &tableName) |
| Drops the table identified by tableName. More... | |
| void | dropIfExists (const QString &tableName) |
| Drops the table identified by tableName if it exists. More... | |
| bool | isDbFeatureAvailable (Migrator::DatabaseFeatures dbFeatures) const |
Returns true if the dbFeatures are available on the used database system. More... | |
| Error | lastError () const |
| Returns error information about the last error (if any) that occurred with this migrator. More... | |
| void | raw (const QString &statement) |
| Executes a raw SQL statement. More... | |
| void | rename (const QString &tableName, const QString &newName) |
| Renames the table named tableName to newName. More... | |
| Table * | table (const QString &tableName) |
| Returns an existing Table object for a table with the given tableName. More... | |
| virtual void | up ()=0 |
| Reimplement this function to perform database operations when performing migrations. More... | |
Contains a single migration instance.
The Migration object represents a single migration instance. A migration is defined by operations defined in the reimplemented up() and down() functions. The reimplemented up() function is called when the migration is done. The reimplemented down() function is called when the migrations will be rolled back. Inside up() and down() use the create(), createTableIfNotExists(), table(), drop(), dropIfExists(), rename() and raw() functions.
Additionally there is the possibility to use a custom function for migration by reimplenting executeUp() and executeDown().
example.h
example.cpp
main.cpp
|
explicit |
Constructs a new Migration object with the given parent.
The parent has to be a valid Migrator object.
|
override |
Deconstructs the Migration object.
Creates a new table with the given tableName.
The tableName is not allowed to be empty. Use the returned Table object to create columns on it.
|
protected |
Returns features supported by the used datbase system.
|
protected |
Returns the type of the used database system.
|
protected |
Returns the name of the used database system.
|
protected |
Returns the version of the used database system.
|
protectedpure virtual |
Reimplement this function to perform database operations when performing migration rollback.
|
protected |
Drops the table identified by tableName.
|
protected |
Drops the table identified by tableName if it exists.
|
protected |
Returns true if the dbFeatures are available on the used database system.
|
protected |
Returns error information about the last error (if any) that occurred with this migrator.
|
protected |
Executes a raw SQL statement.
Renames the table named tableName to newName.
|
protectedpure virtual |
Reimplement this function to perform database operations when performing migrations.
1.8.14