-
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: add todo categories to migrations (#8)
- Loading branch information
Showing
7 changed files
with
51 additions
and
3 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,22 @@ | ||
-- Deploy toudou:categories to pg | ||
|
||
BEGIN; | ||
|
||
-- data definition | ||
create table api.categories ( | ||
id bigint primary key generated always as identity, | ||
title varchar (50) not null, | ||
color varchar (7) not null check ( color ~* '^#[a-f0-9]{6}$') -- check for hex formatted colors | ||
); | ||
|
||
create table api.categories_todos ( | ||
category_id bigint references api.categories(id) on delete restrict, | ||
todo_id bigint references api.todos(id) on delete cascade, | ||
primary key (category_id, todo_id) | ||
); | ||
|
||
-- permissions | ||
grant all on api.categories to web_anon; | ||
grant all on api.categories_todos to web_anon; | ||
|
||
COMMIT; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Revert toudou:categories from pg | ||
|
||
BEGIN; | ||
|
||
-- permissions | ||
revoke all on api.categories_todos from web_anon; | ||
revoke all on api.categories from web_anon; | ||
|
||
-- data definition | ||
drop table api.categories_todos; | ||
drop table api.categories; | ||
|
||
COMMIT; |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
%uri=https://github.com/jobtrek/toudou/ | ||
|
||
todos 2025-01-17T05:45:53Z fuzoh <[email protected]> # Add table to store todos | ||
categories 2025-01-17T08:56:49Z fuzoh <[email protected]> # Add table to store todo categories |
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,7 @@ | ||
-- Verify toudou:categories on pg | ||
|
||
BEGIN; | ||
|
||
-- XXX Add verifications here. | ||
|
||
ROLLBACK; |
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 |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
BEGIN; | ||
|
||
-- XXX Add verifications here. | ||
-- TODO | ||
|
||
ROLLBACK; |