added basic skeleton and two API endpoints to test backend stack.

This commit is contained in:
2022-04-12 20:30:16 +02:00
parent 22e8290371
commit 11c0bd62e2
40 changed files with 1480 additions and 8 deletions
@@ -0,0 +1,13 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE scope (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`abbreviation` CHAR(8) NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS scope;
-- +goose StatementEnd
@@ -0,0 +1,17 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE scope_member (
`scope_id` INT NOT NULL,
`user_id` CHAR(36) NOT NULL,
`name` VARCHAR(63) NOT NULL,
`owner` BOOLEAN NOT NULL,
PRIMARY KEY (`scope_id`, `user_id`),
UNIQUE (`scope_id`, `name`)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS scope_member;
-- +goose StatementEnd
@@ -0,0 +1,18 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE stat (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`name` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`weight` FLOAT NOT NULL,
`allowed_amounts` JSON,
UNIQUE (`scope_id`, `name`)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS stat;
-- +goose StatementEnd
@@ -0,0 +1,18 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`author_id` CHAR(36) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`status` INT NOT NULL,
`description` TEXT NOT NULL,
UNIQUE (`scope_id`, `name`)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS project;
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project_requirement (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`project_id` INT NOT NULL,
`name` VARCHAR(255) NOT NULL,
`status` INT NOT NULL,
`description` TEXT NOT NULL
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS project_requirement;
-- +goose StatementEnd
@@ -0,0 +1,19 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`project_requirement_id` INT,
`name` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`created_time` DATETIME NOT NULL,
`created_user_id` CHAR(36) NOT NULL,
`acquired_time` DATETIME,
`scheduled_date` DATE
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS item;
-- +goose StatementEnd
@@ -0,0 +1,17 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item_stat_progress (
`item_id` INT NOT NULL,
`stat_id` INT NOT NULL,
`acquired` INT NOT NULL,
`required` INT NOT NULL,
PRIMARY KEY (`item_id`, `stat_id`),
UNIQUE (`stat_id`, `item_id`)
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS item_stat_progress;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project_requirement_stat (
`project_requirement_id` INT NOT NULL,
`stat_id` INT NOT NULL,
`required` INT NOT NULL,
PRIMARY KEY (`project_requirement_id`, `stat_id`)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS project_requirement_stat;
-- +goose StatementEnd
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE project ADD COLUMN created_time TIMESTAMP NOT NULL DEFAULT NOW();
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
ALTER TABLE project DROP COLUMN IF EXISTS created_time;
-- +goose StatementEnd