You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.2 KiB

  1. #pragma once
  2. namespace db {
  3. namespace migrations {
  4. namespace db_builder = db::migrations::builder;
  5. class m1624964657_create_alarms : public Migration {
  6. public:
  7. //TODO https://techsparx.com/software-development/sqlite3/mysql-style-enum.html
  8. // action should be an enum
  9. m1624964657_create_alarms() : Migration() {
  10. db_builder::Table create_alarms = db_builder::Table::create("alarms"
  11. ).integer("id", "NOT NULL PRIMARY KEY"
  12. ).text("description"
  13. ).text("action"
  14. ).text("absolute_trigger"
  15. ).integer("event_id", "NOT NULL"
  16. ).fk("event_id", "events", "id", "ON DELETE CASCADE ON UPDATE NO ACTION"
  17. ).constraint("event_time_unique", "event_id, absolute_trigger"
  18. ).close();
  19. m_statement = create_alarms.str();
  20. }
  21. };
  22. }
  23. }