Skip to content

Commit

Permalink
fix db_build sql table name type > relates #1
Browse files Browse the repository at this point in the history
  • Loading branch information
sunuwars committed Aug 8, 2018
1 parent c0faa79 commit 8215de5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB_URL = postgres://sunuwars:sunuwars123@localhost:5432/toolshare
10 changes: 5 additions & 5 deletions src/database/db_build.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CREATE TABLE items (
id SERIAL PRIMARY KEY,
name VARCHAR(80) NOT NULL,
description TEXT,
lender_id INTEGER REFERENCES users (id) NOT NULL
lender_id INTEGER REFERENCES users(id) NOT NULL
);

INSERT INTO items (name, description, lender_id) VALUES
Expand All @@ -26,16 +26,16 @@ INSERT INTO items (name, description, lender_id) VALUES

CREATE TABLE loans (
id SERIAL PRIMARY KEY,
item_id INTEGER REFERENCES items (id) NOT NULL,
borrowers_id INTEGER REFERENCES users (id) NOT NULL,
item_id INTEGER REFERENCES items(id) NOT NULL,
borrowers_id INTEGER REFERENCES users(id) NOT NULL,
issue_date DATE NOT NULL DEFAULT CURRENT_DATE,
return_date DATE
);

INSERT INTO items (item_id, borrowers_id) VALUES
INSERT INTO loans (item_id, borrowers_id) VALUES
(1, 1);

INSERT INTO items (item_id, borrowers_id, issue_date) VALUES
INSERT INTO loans (item_id, borrowers_id, issue_date) VALUES
(2, 2, '2018-07-08');

COMMIT;

0 comments on commit 8215de5

Please sign in to comment.