|
ImagingTools Core SDK
|
Controls database schema versioning and migration execution. More...
#include <IMigrationController.h>
Inherits istd::IPolymorphic.
Inherited by imtdb::CCompositeMigrationControllerComp [virtual], and imtdb::CMigrationControllerCompBase [virtual].
Public Member Functions | |
| virtual istd::CIntRange | GetMigrationRange () const =0 |
| Gets the range of database versions for migration. | |
| virtual bool | DoMigration (int &resultRevision, const istd::CIntRange &subRange=istd::CIntRange()) const =0 |
| Executes database migrations. | |
Controls database schema versioning and migration execution.
IMigrationController manages the evolution of database schemas through versioned migration scripts. It tracks the current database version and executes SQL scripts to upgrade (or downgrade) the schema incrementally.
Migrations are SQL scripts that transform a database schema from one version to another. Each migration has:
Typical migration file structure:
* migrations/ * migration_v001_to_v002.sql -- Create initial tables * migration_v002_to_v003.sql -- Add user email column * migration_v003_to_v004.sql -- Create indexes *
For complex systems with multiple database schemas or modules, use CCompositeMigrationControllerComp to coordinate multiple migration controllers:
Definition at line 76 of file IMigrationController.h.
|
pure virtual |
Executes database migrations.
Runs migration scripts to transform the database schema. Can execute all pending migrations or a specific subset defined by subRange.
The migration process:
| [out] | resultRevision | Receives the final database version after migration |
| subRange | Optional range limiting which migrations to execute:
|
|
pure virtual |
Gets the range of database versions for migration.
Returns the version range from current database version to the latest available migration version.
If first() == last(), no migrations are needed (database is up-to-date). If first() < last(), migrations are available and should be executed.