|
Lightweight 0.20260617.0
|
#include <SqlMigration.hpp>
Inherited by Lightweight::SqlMigration::Migration< TsValue >.
Public Member Functions | |
| MigrationBase (MigrationBase const &)=default | |
| Default copy constructor. | |
| MigrationBase (MigrationBase &&)=delete | |
| MigrationBase & | operator= (MigrationBase const &)=default |
| Default copy assignment operator. | |
| MigrationBase & | operator= (MigrationBase &&)=delete |
| MigrationBase (MigrationTimestamp timestamp, std::string_view title) | |
| Constructs a migration with the given timestamp and title. | |
| virtual void | Up (SqlMigrationQueryBuilder &plan) const =0 |
| virtual void | Down (SqlMigrationQueryBuilder &plan) const |
| virtual bool | HasDownImplementation () const noexcept |
| virtual std::vector< MigrationTimestamp > | GetDependencies () const |
| virtual std::string_view | GetAuthor () const noexcept |
| virtual std::string_view | GetDescription () const noexcept |
| MigrationTimestamp | GetTimestamp () const noexcept |
| std::string_view | GetTitle () const noexcept |
| LIGHTWEIGHT_API std::string | ComputeChecksum (SqlQueryFormatter const &formatter) const |
Represents a single unique SQL migration.
Definition at line 815 of file SqlMigration.hpp.
|
inline |
Constructs a migration with the given timestamp and title.
Definition at line 825 of file SqlMigration.hpp.
References Lightweight::SqlMigration::MigrationManager::AddMigration(), and Lightweight::SqlMigration::MigrationManager::GetInstance().
|
pure virtual |
Apply the migration.
| plan | Query builder to use for building the migration plan. |
|
inlinevirtual |
Revert the migration.
| plan | Query builder to use for building the migration plan. |
Definition at line 842 of file SqlMigration.hpp.
|
inlinevirtualnoexcept |
Check if this migration has a Down() implementation for rollback.
This method determines whether the migration can be safely reverted. The default implementation returns false. Derived classes that implement Down() should override this to return true.
Definition at line 854 of file SqlMigration.hpp.
|
inlinevirtual |
Get the timestamps of migrations that this migration depends on.
Dependencies are enforced at apply time: each declared dependency must be registered and applied (or pending in the same run, in dependency order) before this migration will run. The default implementation returns no dependencies, preserving timestamp-ordered apply behavior.
Definition at line 867 of file SqlMigration.hpp.
|
inlinevirtualnoexcept |
Get the author of the migration, if any.
Definition at line 875 of file SqlMigration.hpp.
|
inlinevirtualnoexcept |
Get the long-form description of the migration, if any.
This is a multi-line description in addition to the short title.
Definition at line 885 of file SqlMigration.hpp.
|
inlinenoexcept |
Get the timestamp of the migration.
Definition at line 893 of file SqlMigration.hpp.
|
inlinenoexcept |
Get the title of the migration.
Definition at line 901 of file SqlMigration.hpp.
| LIGHTWEIGHT_API std::string Lightweight::SqlMigration::MigrationBase::ComputeChecksum | ( | SqlQueryFormatter const & | formatter | ) | const |
Compute SHA-256 checksum of migration's Up() SQL statements.
The checksum is computed from the SQL statements that would be executed by this migration. This allows detecting if a migration has been modified after it was applied.
| formatter | The SQL query formatter to use for generating SQL. |