Skip to content

Commit

Permalink
Update schema
Browse files Browse the repository at this point in the history
Relates #16

Co-authored-by: CampbellDocherty <campbellsofitsidocherty@gmail.com>
  • Loading branch information
Alexreid95 and CampbellDocherty committed May 18, 2020
1 parent 7925746 commit eb5a688
Showing 1 changed file with 54 additions and 19 deletions.
73 changes: 54 additions & 19 deletions wip-rest-api/src/database/init.sql
Original file line number Diff line number Diff line change
@@ -1,31 +1,66 @@
BEGIN;

DROP TABLE IF EXISTS users, posts;
DROP TABLE IF EXISTS users, projects, steps, feedback;

CREATE TABLE users(
-- id SERIAL PRIMARY KEY UNIQUE,
-- username VARCHAR(255) NOT NULL UNIQUE,
-- email VARCHAR(255) NOT NULL UNIQUE,
-- password VARCHAR(255)
);
CREATE TABLE users
(
id SERIAL PRIMARY KEY UNIQUE,
username VARCHAR(255) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
user_bio VARCHAR(255),
user_vocation VARCHAR(50),
user_link_1 VARCHAR(50),
user_link_2 VARCHAR(50),
user_link_3 VARCHAR(50)
);

CREATE TABLE posts(
-- id SERIAL PRIMARY KEY,
-- user_id INTEGER REFERENCES users(id),
-- category VARCHAR(255) NOT NULL,
-- tool_name VARCHAR(255),
-- tool_description VARCHAR(255),
-- tool_link VARCHAR(255)
);
CREATE TABLE projects
(
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id),
project_name VARCHAR(255),
project_description VARCHAR(255),
-- project_status BOOLEAN
);

INSERT INTO users (username, email, password) VALUES ()
CREATE TABLE steps
(
id SERIAL PRIMARY KEY,
project_id INTEGER REFERENCES projects(id),
step_name VARCHAR(255),
step_description VARCHAR(255),
step_link VARCHAR(255)
)

CREATE TABLE feedback
(
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id),
project_id INTEGER REFERENCES projects(id),
step_id INTEGER REFERENCES steps(id),
feedback_text VARCHAR(255),
feedback_tag VARCHAR(50),
);

INSERT INTO categories (category) VALUES ()
INSERT INTO users
(username, email, password, user_bio, user_vocation, user_link_1, user_link_2, user_link_3)
VALUES
('CampbellDocherty', 'hey@123.com', 'progression', 'I am a freelance illustrator trying to make it big', 'Freelance Illustrator', 'www.facebook.com', 'www.instagram.com', 'www.dribbble.com')

INSERT INTO projects
(project_name, project_description)
VALUES
('A tree', 'My first attempt at drawing a tree')

INSERT INTO posts (user_id, cat_id, tool_name, tool_description, tool_link, date_added) VALUES
(1,3, 'Netflix', 'Stream shows and movies', 'netflix.com', '2019-08-01'),
INSERT INTO steps
(step_name, step_description, step_link)
VALUES
('1st sketch', 'My frst sketch of the trunk', 'https://i.pinimg.com/originals/01/0b/5e/010b5e4a0f38a9331d872ac0c179efff.jpg')

INSERT INTO feedback
(feedback_text, feedback_tag)
VALUES
("Nice work! Look forward to seeing it in colour!", "Compliment ")

END;

0 comments on commit eb5a688

Please sign in to comment.