Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit::orm::MigrationResult Struct Reference

Database migration runner (PostgreSQL) More...

#include <MigrationRunner.hpp>

Public Member Functions

bool ok () const
 
std::string summary () const
 

Public Attributes

std::vector< std::string > applied
 Files applied by this run, in order.
 
std::string error
 Why the run stopped; empty on success.
 
bool directory_missing = false
 The migrations directory does not exist (not an error).
 

Detailed Description

Database migration runner (PostgreSQL)

Scans a directory for .sql files, checks which have been applied against the orbit_migrations table, and applies any pending files in name order. Each file runs in its own transaction together with its tracking row, so a failing migration leaves no trace and stops the run. A PostgreSQL advisory lock keeps concurrent runners (e.g. several app instances starting at once) from applying the same file twice.

Statements that cannot run inside a transaction (such as CREATE INDEX CONCURRENTLY) are not supported. The outcome of a migration run.

Member Function Documentation

◆ ok()

bool orbit::orm::MigrationResult::ok ( ) const
inline

◆ summary()

std::string orbit::orm::MigrationResult::summary ( ) const
inline

"Database is up to date", "Successfully applied N migrations.", "Migrations skipped - no directory" or the error.

Member Data Documentation

◆ applied

std::vector<std::string> orbit::orm::MigrationResult::applied

Files applied by this run, in order.

◆ directory_missing

bool orbit::orm::MigrationResult::directory_missing = false

The migrations directory does not exist (not an error).

◆ error

std::string orbit::orm::MigrationResult::error

Why the run stopped; empty on success.


The documentation for this struct was generated from the following file: