|
1 | 1 | -- Create "questions" table |
2 | | -CREATE TABLE "public"."questions" ("id" uuid NOT NULL, "description" text NULL, "title" text NULL, "input_format" text NULL, "points" integer NULL, "round" integer NOT NULL, "constraints" text NULL, "output_format" text NULL, PRIMARY KEY ("id")); |
| 2 | +CREATE TABLE "public"."questions" ("id" uuid NOT NULL, "description" text NOT NULL, "title" text NOT NULL, "input_format" text[] NULL, "points" integer NOT NULL, "round" integer NOT NULL, "constraints" text[] NOT NULL, "output_format" text[] NOT NULL, "sample_test_input" text[] NULL, "sample_test_output" text[] NULL, "explanation" text[] NULL, PRIMARY KEY ("id")); |
3 | 3 | -- Create "testcases" table |
4 | | -CREATE TABLE "public"."testcases" ("id" uuid NOT NULL, "expected_output" text NULL, "memory" text NULL, "input" text NULL, "hidden" boolean NULL, "runtime" numeric NULL, "question_id" uuid NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "testcases_question_id_fkey" FOREIGN KEY ("question_id") REFERENCES "public"."questions" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION); |
| 4 | +CREATE TABLE "public"."testcases" ("id" uuid NOT NULL, "expected_output" text NOT NULL, "memory" numeric NOT NULL, "input" text NOT NULL, "hidden" boolean NOT NULL, "runtime" numeric NOT NULL, "question_id" uuid NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "testcases_question_id_fkey" FOREIGN KEY ("question_id") REFERENCES "public"."questions" ("id") ON UPDATE NO ACTION ON DELETE CASCADE); |
5 | 5 | -- Create "users" table |
6 | 6 | CREATE TABLE "public"."users" ("id" uuid NOT NULL, "email" text NOT NULL, "reg_no" text NOT NULL, "password" text NOT NULL, "role" text NOT NULL, "round_qualified" integer NOT NULL DEFAULT 0, "score" integer NULL DEFAULT 0, "name" text NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "users_email_key" UNIQUE ("email"), CONSTRAINT "users_reg_no_key" UNIQUE ("reg_no")); |
7 | 7 | -- Create "submissions" table |
8 | | -CREATE TABLE "public"."submissions" ("id" uuid NOT NULL, "question_id" uuid NOT NULL, "testcases_passed" integer NULL DEFAULT 0, "testcases_failed" integer NULL DEFAULT 0, "runtime" numeric NULL, "submission_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, "testcase_id" uuid NULL, "language_id" integer NOT NULL, "description" text NULL, "memory" integer NULL, "user_id" uuid NULL, "status" text NULL, PRIMARY KEY ("id"), CONSTRAINT "submissions_question_id_fkey" FOREIGN KEY ("question_id") REFERENCES "public"."questions" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT "submissions_testcase_id_fkey" FOREIGN KEY ("testcase_id") REFERENCES "public"."testcases" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT "submissions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."users" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION); |
| 8 | +CREATE TABLE "public"."submissions" ("id" uuid NOT NULL, "question_id" uuid NOT NULL, "testcases_passed" integer NULL DEFAULT 0, "testcases_failed" integer NULL DEFAULT 0, "runtime" numeric NULL, "submission_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, "testcase_id" uuid NULL, "language_id" integer NOT NULL, "description" text NULL, "memory" integer NULL, "user_id" uuid NULL, "status" text NULL, PRIMARY KEY ("id"), CONSTRAINT "submissions_question_id_fkey" FOREIGN KEY ("question_id") REFERENCES "public"."questions" ("id") ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT "submissions_testcase_id_fkey" FOREIGN KEY ("testcase_id") REFERENCES "public"."testcases" ("id") ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT "submissions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."users" ("id") ON UPDATE NO ACTION ON DELETE CASCADE); |
0 commit comments