> be fist commit

This commit is contained in:
2020-04-13 23:38:41 +02:00
commit 4cce632708
69 changed files with 7852 additions and 0 deletions
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project (
project_id CHAR(16) NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
daily_points INTEGER NOT NULL,
FULLTEXT(name, description)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE project;
-- +goose StatementEnd
@@ -0,0 +1,30 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE issue (
issue_id CHAR(32) NOT NULL PRIMARY KEY,
project_id CHAR(16) NOT NULL,
owner_id CHAR(32) NOT NULL,
assignee_id CHAR(32) NOT NULL,
status_stage INTEGER NOT NULL,
status_name CHAR(32) NOT NULL,
created_time TIMESTAMP NOT NULL,
updated_time TIMESTAMP NOT NULL,
due_time TIMESTAMP NOT NULL,
name VARCHAR(255) NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
FULLTEXT(name, title, description),
INDEX(owner_id),
INDEX(assignee_id),
INDEX(project_id, status_stage, status_name),
INDEX(project_id),
INDEX(created_time),
INDEX(updated_time)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE issue;
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item (
item_id CHAR(32) NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
image_url VARCHAR(255),
FULLTEXT(name, description)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE item;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item_tag (
item_id CHAR(32),
tag VARCHAR(255),
PRIMARY KEY (item_id, tag),
INDEX (tag)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE item_tag;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE user (
user_id CHAR(32) NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
active BOOL NOT NULL,
admin BOOL NOT NULL,
hash VARCHAR(255) NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE user;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE counters (
kind CHAR(16) NOT NULL,
name CHAR(32) NOT NULL,
value INT NOT NULL,
PRIMARY KEY (kind, name)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE counters;
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project_permission (
project_id CHAR(16) NOT NULL,
user_id CHAR(32) NOT NULL,
access_level INTEGER NOT NULL DEFAULT (0),
PRIMARY KEY (project_id, user_id),
INDEX (user_id)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE project_permission
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE session (
session_id CHAR(32) NOT NULL PRIMARY KEY,
user_id CHAR(32) NOT NULL,
expiry_time TIMESTAMP NOT NULL,
INDEX(expiry_time)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE session;
-- +goose StatementEnd