Create a plan for implementing projects and also create the backend API. (#19)
Some checks failed
Check / Backend (push) Successful in 6m55s
Check / Frontend (push) Successful in 2m2s
Docker Build / Build and Push Backend Image (push) Failing after 11m21s
Docker Build / Build and Push Frontend Image (push) Successful in 5m44s

Creates projects to organize tasks under. (Note the migration also contains the tables for creating folders for projects as well because adding foreign keys is a PITA in sqlite apparently).

Reviewed-on: #19
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
Drew 2025-10-28 04:13:12 +00:00 committed by Drew
parent 69f4a6f1ca
commit 4552c347c6
17 changed files with 957 additions and 12 deletions

View file

@ -0,0 +1,17 @@
ALTER TABLE tasks RENAME TO tasks_old;
CREATE TABLE tasks (
id UUID PRIMARY KEY NOT NULL,
title VARCHAR NOT NULL,
description TEXT,
status TEXT CHECK(status IN ('todo', 'done', 'backlog')) DEFAULT 'todo',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
completed_at TIMESTAMP
);
INSERT INTO tasks SELECT id, title, description, status, created_at, updated_at, completed_at FROM tasks_old;
DROP TABLE tasks_old;
DROP TABLE projects;
DROP TABLE folders;

View file

@ -0,0 +1,39 @@
CREATE TABLE folders (
id UUID PRIMARY KEY NOT NULL,
title VARCHAR NOT NULL,
sort_order INTEGER NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE projects (
id UUID PRIMARY KEY NOT NULL,
title VARCHAR NOT NULL,
color VARCHAR(7) NOT NULL, -- hex code
folder_id UUID,
sort_order INTEGER NOT NULL UNIQUE,
status TEXT CHECK(status IN ('active', 'done', 'backlog')) DEFAULT 'active',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
completed_at TIMESTAMP,
FOREIGN KEY(folder_id) REFERENCES folders(id)
);
ALTER TABLE tasks RENAME TO tasks_old;
-- Add up migration script here
CREATE TABLE tasks (
id UUID PRIMARY KEY NOT NULL,
title VARCHAR NOT NULL,
description TEXT,
status TEXT CHECK(status IN ('todo', 'done', 'backlog')) DEFAULT 'todo',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
completed_at TIMESTAMP,
project_id UUID,
FOREIGN KEY(project_id) REFERENCES projects(id)
);
INSERT INTO tasks SELECT *, NULL as project_id FROM tasks_old;
DROP TABLE tasks_old;