Skip to content

Commit

Permalink
Uploaded Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelin-96 committed Jun 10, 2022
1 parent 4a5d004 commit a7fd792
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 0 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "foo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Baratheonly/SDC-QnA.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Baratheonly/SDC-QnA/issues"
},
"homepage": "https://github.com/Baratheonly/SDC-QnA#readme"
}
Empty file added server/.gitignore
Empty file.
Empty file added server/schema/.gitignore
Empty file.
35 changes: 35 additions & 0 deletions server/schema/answers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- Table: public.answers

-- DROP TABLE IF EXISTS public.answers;

CREATE TABLE IF NOT EXISTS public.answers
(
id integer NOT NULL DEFAULT nextval('answers_id_seq'::regclass),
question_id bigint NOT NULL,
body character varying(1000) COLLATE pg_catalog."default" NOT NULL,
answerer_name character varying(60) COLLATE pg_catalog."default" NOT NULL,
answerer_email character varying(60) COLLATE pg_catalog."default" NOT NULL,
reported boolean NOT NULL DEFAULT false,
helpful integer NOT NULL DEFAULT 0,
date_written bigint DEFAULT EXTRACT(epoch FROM CURRENT_TIMESTAMP),
"timestamp" timestamp(0) with time zone,
CONSTRAINT answers_pkey PRIMARY KEY (id),
CONSTRAINT question_id FOREIGN KEY (question_id)
REFERENCES public.questions (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.answers
OWNER to michaellin;
-- Index: fki_question_id

-- DROP INDEX IF EXISTS public.fki_question_id;

CREATE INDEX IF NOT EXISTS fki_question_id
ON public.answers USING btree
(question_id ASC NULLS LAST)
TABLESPACE pg_default;
29 changes: 29 additions & 0 deletions server/schema/answers_photos.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- Table: public.answers_photos

-- DROP TABLE IF EXISTS public.answers_photos;

CREATE TABLE IF NOT EXISTS public.answers_photos
(
id integer NOT NULL DEFAULT nextval('answers_photos_id_seq'::regclass),
answer_id bigint NOT NULL,
url character varying(255) COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT answers_photos_pkey PRIMARY KEY (id),
CONSTRAINT answer_id FOREIGN KEY (answer_id)
REFERENCES public.answers (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.answers_photos
OWNER to michaellin;
-- Index: fki_answer_id

-- DROP INDEX IF EXISTS public.fki_answer_id;

CREATE INDEX IF NOT EXISTS fki_answer_id
ON public.answers_photos USING btree
(answer_id ASC NULLS LAST)
TABLESPACE pg_default;
22 changes: 22 additions & 0 deletions server/schema/questions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Table: public.questions

-- DROP TABLE IF EXISTS public.questions;

CREATE TABLE IF NOT EXISTS public.questions
(
id integer NOT NULL DEFAULT nextval('questions_id_seq'::regclass),
product_id bigint NOT NULL,
body character varying(1000) COLLATE pg_catalog."default" NOT NULL,
asker_name character varying(60) COLLATE pg_catalog."default" NOT NULL,
asker_email character varying(60) COLLATE pg_catalog."default" NOT NULL,
reported boolean NOT NULL,
helpful integer NOT NULL,
date_written bigint,
"timestamp" timestamp(0) with time zone,
CONSTRAINT questions_pkey PRIMARY KEY (id)
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.questions
OWNER to michaellin;

0 comments on commit a7fd792

Please sign in to comment.