|
Lightweight 0.20260617.0
|
Classes and functions for SQL schema migrations. More...
Macros | |
| #define | LIGHTWEIGHT_MIGRATION_PLUGIN() |
| #define | LIGHTWEIGHT_MIGRATION_PLUGIN_POSTINIT(connArg, mgrArg) |
| #define | LIGHTWEIGHT_MIGRATION_INSTANCE(timestamp) migration_##timestamp |
| Represents the C++ migration object for a given timestamped migration. | |
| #define | LIGHTWEIGHT_SQL_MIGRATION(timestamp, description) |
| Creates a new migration. | |
| #define | LIGHTWEIGHT_SQL_MIGRATION_REVERSIBLE(timestamp, description) |
Creates a new reversible migration whose Down() is defined out-of-line via LIGHTWEIGHT_SQL_MIGRATION_DOWN. | |
| #define | LIGHTWEIGHT_SQL_MIGRATION_DOWN(timestamp) void Migration_##timestamp::Down(Lightweight::SqlMigrationQueryBuilder& plan) const |
Companion to LIGHTWEIGHT_SQL_MIGRATION_REVERSIBLE — defines the out-of-line Down() body. | |
| #define | LIGHTWEIGHT_SQL_RELEASE(version, highestTimestamp) |
| Associates a software release (version string) with the highest migration timestamp present at the time of that release. | |
Classes and functions for SQL schema migrations.
| #define LIGHTWEIGHT_MIGRATION_PLUGIN | ( | ) |
Requires the user to call LIGHTWEIGHT_MIGRATION_PLUGIN() in exactly one CPP file of the migration plugin.
Definition at line 785 of file SqlMigration.hpp.
| #define LIGHTWEIGHT_MIGRATION_PLUGIN_POSTINIT | ( | connArg, | |
| mgrArg | |||
| ) |
Optional hook executed once per plugin by dbtool, after migration history has been created and an active connection is available on the central manager. Plugins use this to perform one-shot bridging work that needs both a live SqlConnection and the merged MigrationManager — for example, importing legacy version tracking from a custom table into schema_migrations.
Use as:
Definition at line 808 of file SqlMigration.hpp.
| #define LIGHTWEIGHT_MIGRATION_INSTANCE | ( | timestamp | ) | migration_##timestamp |
Represents the C++ migration object for a given timestamped migration.
| timestamp | Timestamp of the migration. |
Definition at line 1074 of file SqlMigration.hpp.
| #define LIGHTWEIGHT_SQL_MIGRATION | ( | timestamp, | |
| description | |||
| ) |
Creates a new migration.
| timestamp | Timestamp of the migration. |
| description | Description of the migration. |
Definition at line 1094 of file SqlMigration.hpp.
| #define LIGHTWEIGHT_SQL_MIGRATION_REVERSIBLE | ( | timestamp, | |
| description | |||
| ) |
Creates a new reversible migration whose Down() is defined out-of-line via LIGHTWEIGHT_SQL_MIGRATION_DOWN.
Use this variant when the migration needs to be reversible. Follow the macro with the Up() body, then later use LIGHTWEIGHT_SQL_MIGRATION_DOWN(timestamp) { ... } to provide the Down() body.
| timestamp | Timestamp of the migration. |
| description | Description of the migration. |
Definition at line 1135 of file SqlMigration.hpp.
| #define LIGHTWEIGHT_SQL_MIGRATION_DOWN | ( | timestamp | ) | void Migration_##timestamp::Down(Lightweight::SqlMigrationQueryBuilder& plan) const |
Companion to LIGHTWEIGHT_SQL_MIGRATION_REVERSIBLE — defines the out-of-line Down() body.
Must be used in the same translation unit and follow the matching LIGHTWEIGHT_SQL_MIGRATION_REVERSIBLE(timestamp, ...) declaration.
| timestamp | Timestamp of the migration whose Down() body follows. |
Definition at line 1165 of file SqlMigration.hpp.
| #define LIGHTWEIGHT_SQL_RELEASE | ( | version, | |
| highestTimestamp | |||
| ) |
Associates a software release (version string) with the highest migration timestamp present at the time of that release.
Declare one LIGHTWEIGHT_SQL_RELEASE per cut release, alongside the migrations that belong to it. The macro registers with the migration manager at static-initialization time. Multiple releases may coexist in the same translation unit.
| version | A string literal, e.g. "6.7.0". |
| highestTimestamp | An unsigned integer literal matching the timestamp format used by migrations. |
Definition at line 1187 of file SqlMigration.hpp.