Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload files #41

Merged
merged 20 commits into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions migrations/000009_create_files_table.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS files (
id uuid NOT NULL,
file_source_id uuid,
name varchar DEFAULT '',
size bigint DEFAULT 0,
mime_type varchar DEFAULT '',
file_status int DEFAULT 1,
upload_error text DEFAULT '',
updated_at timestamptz DEFAULT CURRENT_TIMESTAMP,
created_at timestamptz DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id)
);

CREATE INDEX IF NOT EXISTS files_file_source_id_idx ON files (file_source_id);
2 changes: 2 additions & 0 deletions migrations/000010_queries_alter_report_id.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE queries
ALTER COLUMN report_id drop not null;
12 changes: 12 additions & 0 deletions migrations/000011_create_dataset_table.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS datasets (
report_id uuid NOT NULL,
id uuid NOT NULL,
query_id uuid,
file_id uuid,
updated_at timestamptz DEFAULT CURRENT_TIMESTAMP,
created_at timestamptz DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
CONSTRAINT fk_report FOREIGN KEY(report_id) REFERENCES reports,
CONSTRAINT fk_file FOREIGN KEY(file_id) REFERENCES files,
CONSTRAINT fk_query FOREIGN KEY(query_id) REFERENCES queries
);
Loading