OXYGENHUB
# ac689cd21adf oxygenhub / crates / hub / migrations-pg / 0100_board_iterations.sql
837 B · SQL · last changed Iterations on project boards: a named span of days with a burn-up of cards done; closing one archives its Done column's cards under it, its page lists them (closes #343) 9 days ago source blame history raw
1
-- Iterations on project boards (oxygenhub#343): a named span of days. A
2
-- board has at most one open at a time; closing it archives the cards in
3
-- its Done column under it, so the board shows the current iteration and
4
-- each past one keeps its cards and its burn-up.
5
CREATE TABLE project_iterations (
6
    id         BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
7
    project_id BIGINT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
8
    name       TEXT NOT NULL,
9
    start_ms   BIGINT NOT NULL,
10
    end_ms     BIGINT NOT NULL,
11
    closed_ms  BIGINT
12
);
13
CREATE INDEX project_iterations_by_project ON project_iterations (project_id, start_ms);
14
-- The iteration a card was archived under when that iteration closed.
15
ALTER TABLE project_cards ADD COLUMN iteration_id BIGINT REFERENCES project_iterations(id) ON DELETE SET NULL;