Open christianparpart opened 2 months ago
with my background I would suggest something like this
struct Migration
{
constexpr std::string revision = "20241011130024120" // current datetime with microseconds and also the suffix of the current file
constexpr std::string down_revision = "" // the previous one if any
[[ nodiscard ]] bool upgrade()
{
migration.CreateTable([](auto& table) {
table.Column<std::optional<int>>("secret_number").Indexed();
table.Column<std::optional<std::string>, MaxChars { 30 }>("description");
table.Column<Guid>("id");
table.PrimaryKey("id");
});
}
// will be executed if upgrade fails
[[ nodiscard ]] bool downgrade()
{
migration.DropTable("deprecated_records");
}
}
the idea is if from Alembic
Requirements
Ideas
A single C++ migration might look like this: