Add initial sql tables

This commit is contained in:
Joshua Coles 2024-07-16 17:25:01 +01:00
parent 4cbb60b5ac
commit 08ed00a555
2 changed files with 51 additions and 0 deletions

5
build.rs Normal file
View File

@ -0,0 +1,5 @@
// generated by `sqlx migrate build-script`
fn main() {
// trigger recompilation when a new migration is added
println!("cargo:rerun-if-changed=migrations");
}

View File

@ -0,0 +1,46 @@
create table workspaces (
id BIGINT PRIMARY KEY,
organization_id BIGINT NOT NULL,
name TEXT NOT NULL
);
CREATE TABLE tags (
id BIGINT PRIMARY KEY,
name TEXT NOT NULL,
workspace_id BIGINT NOT NULL,
creator_id BIGINT NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
deleted_at TIMESTAMP WITH TIME ZONE,
permissions TEXT
);
CREATE TABLE projects (
id BIGINT PRIMARY KEY,
workspace_id BIGINT NOT NULL,
client_id BIGINT,
name TEXT NOT NULL,
color TEXT NOT NULL,
status TEXT NOT NULL,
active BOOLEAN NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
start_date DATE NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
server_deleted_at TIMESTAMP WITH TIME ZONE,
actual_hours BIGINT,
actual_seconds BIGINT,
can_track_time BOOLEAN NOT NULL,
permissions TEXT
);
CREATE TABLE tracking_clients (
id BIGINT PRIMARY KEY,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
archived BOOLEAN NOT NULL,
creator_id BIGINT NOT NULL,
integration_provider TEXT,
notes TEXT,
name TEXT NOT NULL,
server_deleted_at TIMESTAMP WITH TIME ZONE,
workspace_id BIGINT NOT NULL,
permissions TEXT
);