diff --git a/db/migrations/1624964657_create_alarms.h b/db/migrations/1624964657_create_alarms.h index 89b9b70..b1a1d30 100644 --- a/db/migrations/1624964657_create_alarms.h +++ b/db/migrations/1624964657_create_alarms.h @@ -10,11 +10,13 @@ namespace db { // action should be an enum m1624964657_create_alarms() : Migration() { db_builder::Table create_alarms = db_builder::Table::create("alarms" - ).integer("id", "PRIMARY KEY" - ).integer("eventID", "REFERENCES events(uid)" + ).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();