CREATE TABLE _tas_info (
  version     INTEGER     PRIMARY KEY
);

CREATE TABLE tasks (
  id          INTEGER     PRIMARY KEY,
  name        TEXT        NOT NULL,
  project     TEXT        NULL,
  link        TEXT        NULL,
  dir_path    TEXT        NULL,

  current     BOOLEAN     NOT NULL DEFAULT false,

  created_at  DATETIME    NOT NULL DEFAULT datetime('now'),
  finished_at DATETIME    NULL
);

CREATE VIEW active_tasks AS (
  SELECT t.*
  FROM tasks AS t
  WHERE t.finished_at IS NULL
  ORDER BY t.created_at
);
;
