#pragma once namespace db { namespace migrations { namespace db_builder = db::migrations::builder; class m1624964657_create_alarms : public Migration { public: //TODO https://techsparx.com/software-development/sqlite3/mysql-style-enum.html // action should be an enum m1624964657_create_alarms() : Migration() { db_builder::Table create_alarms = db_builder::Table::create("alarms" ).integer("id", "NOT NULL PRIMARY KEY" ).text("description" ).text("action" ).text("absolute_trigger" ).integer("event_id", "NOT NULL" ).fk("event_id", "events", "id", "ON DELETE CASCADE ON UPDATE NO ACTION" ).constraint("event_time_unique", "event_id, absolute_trigger" ).close(); m_statement = create_alarms.str(); } }; } }