From 47d81ffbd3e4fe178d2935325e312cef77276250 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Wed, 7 Aug 2024 23:22:07 +0900
Subject: feat(backend): create submission_results table

---
 backend/schema.sql | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'backend/schema.sql')

diff --git a/backend/schema.sql b/backend/schema.sql
index 7188d72..74d1202 100644
--- a/backend/schema.sql
+++ b/backend/schema.sql
@@ -64,6 +64,17 @@ CREATE TABLE submissions (
     CONSTRAINT fk_user_id FOREIGN KEY(user_id) REFERENCES users(user_id)
 );
 
+CREATE TABLE submission_results (
+    submission_result_id SERIAL      PRIMARY KEY,
+    submission_id        INT         NOT NULL UNIQUE,
+    status               VARCHAR(16) NOT NULL,
+    stdout               TEXT        NOT NULL,
+    stderr               TEXT        NOT NULL,
+    created_at           TIMESTAMP   NOT NULL DEFAULT NOW(),
+    CONSTRAINT fk_submission_id FOREIGN KEY(submission_id) REFERENCES submissions(submission_id)
+);
+CREATE INDEX idx_submission_results_submission_id ON submission_results(submission_id);
+
 CREATE TABLE testcase_results (
     testcase_result_id SERIAL      PRIMARY KEY,
     submission_id      INT         NOT NULL,
-- 
cgit v1.2.3-70-g09d2

