first commit

This commit is contained in:
2020-12-31 17:49:54 +01:00
commit 2240985aa1
120 changed files with 11574 additions and 0 deletions
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE "group" (
group_id CHAR(16) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
name TEXT NOT NULL,
icon TEXT NOT NULL,
description TEXT NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE "group";
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item (
item_id CHAR(16) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
group_id CHAR(16) NOT NULL,
group_weight INT NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE item;
-- +goose StatementEnd
@@ -0,0 +1,18 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project (
project_id CHAR(16) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL,
icon TEXT NOT NULL,
active BOOLEAN NOT NULL,
created_time TIMESTAMP NOT NULL,
end_time TIMESTAMP
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE project;
-- +goose StatementEnd
@@ -0,0 +1,20 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE task (
task_id CHAR(16) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
item_id CHAR(16) NOT NULL,
project_id CHAR(16) NOT NULL,
item_amount INT NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL,
created_time TIMESTAMP NOT NULL,
active BOOLEAN NOT NULL,
end_time TIMESTAMP
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE task;
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE log (
log_id CHAR(16) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
task_id CHAR(16) NOT NULL,
item_id CHAR(16) NOT NULL,
logged_time TIMESTAMP NOT NULL,
description TEXT NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE log;
-- +goose StatementEnd
@@ -0,0 +1,18 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE goal (
goal_id CHAR(16) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
group_id CHAR(16) NOT NULL,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
amount INTEGER NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE goal;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX item_group_id on item(group_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX item_group_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX log_task_id on log(task_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX log_task_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX goal_start_time on goal(start_time);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX goal_start_time;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX goal_end_time on goal(end_time);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX goal_end_time;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX group_user_id on "group"(user_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX group_user_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX item_user_id on item(user_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX item_user_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX project_user_id on project(user_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX project_user_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX task_user_id on task(user_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX task_user_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX log_user_id on log(user_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX log_user_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX goal_user_id on goal(user_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX goal_user_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX project_created_time on project(created_time);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX project_created_time;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX task_item_id on task(item_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX task_item_id;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX log_logged_time on log(logged_time);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX log_logged_time;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
CREATE INDEX log_item_id on log(item_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP INDEX log_item_id;
-- +goose StatementEnd