-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: db πΎ migrations π + pretty logging π (#27)
- Loading branch information
1 parent
c5b83c5
commit 88938ad
Showing
8 changed files
with
424 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ALTER TABLE tasks RENAME TO tasks_old; | ||
|
||
CREATE TABLE tasks ( | ||
name TEXT NOT NULL DEFAULT 'default', | ||
project_name TEXT NOT NULL, | ||
description TEXT NULL DEFAULT NULL, | ||
date DATE NOT NULL DEFAULT (DATE('now','localtime')), | ||
seconds INTEGER NOT NULL DEFAULT 0 | ||
); | ||
INSERT INTO tasks (name,project_name,description,date,seconds) SELECT name,project_name,description,date,seconds FROM tasks_old; | ||
|
||
DROP TABLE tasks_old; | ||
|
||
UPDATE db_version SET version = '2024-05-19-001' WHERE version = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ALTER TABLE tasks ADD COLUMN status TEXT NOT NULL DEFAULT 'active'; | ||
ALTER TABLE projects ADD COLUMN status TEXT NOT NULL DEFAULT 'active'; | ||
ALTER TABLE task_definitions ADD COLUMN status TEXT NOT NULL DEFAULT 'active'; | ||
|
||
UPDATE db_version SET version = '2024-05-19-002' WHERE version = '2024-05-19-001'; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
CREATE TABLE IF NOT EXISTS projects ( | ||
name TEXT NOT NULL UNIQUE | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS tasks ( | ||
name TEXT NOT NULL DEFAULT 'default', | ||
project_name TEXT NOT NULL, | ||
description TEXT NULL DEFAULT NULL, | ||
date DATE NOT NULL DEFAULT (DATE('now','localtime')), | ||
seconds INTEGER NOT NULL DEFAULT 0 | ||
); | ||
|
||
CREATE UNIQUE INDEX tasks_name_date_pjn_IDX ON tasks (name,date,project_name); | ||
|
||
CREATE TABLE IF NOT EXISTS task_definitions ( | ||
name TEXT NOT NULL, | ||
project_name TEXT NOT NULL | ||
); | ||
|
||
CREATE UNIQUE INDEX tasks_defs_name_pjn_IDX ON task_definitions (name,project_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters