Skip to content

Commit

Permalink
Merge pull request #202 from AznBoy00/update-db-script
Browse files Browse the repository at this point in the history
Update db script  + SAD + SRS Upload
  • Loading branch information
kkhh001 authored Nov 23, 2018
2 parents 371c9c3 + 94d6e45 commit cfee897
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 23 deletions.
Binary file added SRS-SAD/SAD-TEAM5.pdf
Binary file not shown.
Binary file added SRS-SAD/SRS-TEAM5.pdf
Binary file not shown.
64 changes: 41 additions & 23 deletions dbscript.sql
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CREATE TABLE Movies(
language VARCHAR(50) DEFAULT 'English',
dubbed VARCHAR(50),
subtitles VARCHAR(50),
actors VARCHAR(50),
actors VARCHAR(280),
release_date DATE, /* YYYY-MM-DD */
run_time INT, /* in minutes (127 minutes) */

Expand Down Expand Up @@ -143,33 +143,39 @@ INSERT INTO Users
VALUES(
'$2a$10$rPujXPqDTDjQWBkR4iPKrOhK0r2KJtAeoOqmMUgF/iruNsEEB18aa',
5141234567,'[email protected]','123 Rue Guy,
Montreal','Momo','Taleb','5',FALSE);
Montreal','Chris','Miller','5',FALSE);
INSERT INTO Users
(password, phone, email, address, f_name, l_name, num_permitted_items, is_admin)
VALUES(
'$2a$10$rPujXPqDTDjQWBkR4iPKrOhK0r2KJtAeoOqmMUgF/iruNsEEB18aa',
5141234567,'[email protected]','123 Rue Guy,
Montreal','C','C','5',FALSE);
Montreal','Lucila','Polanco','5',FALSE);
INSERT INTO Users
(password, phone, email, address, f_name, l_name, num_permitted_items, is_admin)
VALUES(
'$2a$10$rPujXPqDTDjQWBkR4iPKrOhK0r2KJtAeoOqmMUgF/iruNsEEB18aa',
5141234567,'[email protected]','123 Rue Guy,
Montreal','Bob','Ghandi','5',FALSE);
Montreal','Shauna','Masters','5',FALSE);
INSERT INTO Users
(password, phone, email, address, f_name, l_name, num_permitted_items, is_admin)
VALUES(
'$2a$10$rPujXPqDTDjQWBkR4iPKrOhK0r2KJtAeoOqmMUgF/iruNsEEB18aa',
5141234567,'[email protected]','123 Rue Guy,
Montreal','Marcus','Aurelius','5',FALSE);
INSERT INTO Users
(password, phone, email, address, f_name, l_name, num_permitted_items, is_admin)
VALUES(
'$2a$10$rPujXPqDTDjQWBkR4iPKrOhK0r2KJtAeoOqmMUgF/iruNsEEB18aa',
5141234567,'[email protected]','123 Rue Guy,
Montreal','Mike','Hunt','5',FALSE);

/* ======== Insert New Books ======== */
/* (book_id, item_id, title, author, publisher, quantity, isbn10, isbn13) */

INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'War Dogs', 'Michael J. Fox', 801, 'Anton', 5, '2018-10-01', 1234567890, 1234567890000
SELECT select_id, 'War Dogs', 'Greg Bear', 291, 'Orbit Books', 5, '2014-01-01', 1234567890, 1234567890000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Books');
Expand All @@ -187,58 +193,70 @@ INSERT INTO Books
INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'The Alchemist', 'Paolo Coelho', 661, 'Penguin', 2, '2010-10-10', 1234567893, 1234567893000
SELECT select_id, 'The Alchemist', 'Paolo Coelho', 661, 'Penguin', 3, '2010-10-10', 1234567893, 1234567893000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'The Golden mean', 'Annabel Lyon', 772, 'Penguin', 1, '2011-05-20', 1234567897, 1234567893007
SELECT select_id, 'The Golden mean', 'Annabel Lyon', 772, 'Penguin', 5, '2011-05-20', 1234567894, 1234567894000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'SPQR: A History of Ancient Rome', 'Mary Beard', 608, 'Liveright', 1, '2005-07-22', 1234564897, 1234564893007
SELECT select_id, 'SPQR: A History of Ancient Rome', 'Mary Beard', 608, 'Liveright', 4, '2005-07-22', 1234567895, 1234567895000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'The Lessons of History', ' Will and Ariel Durant', 128, 'Simon & Schuster', 1, '1995-12-13', 1439149950, 9781439149959
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;
SELECT select_id, 'The Lessons of History', ' Will and Ariel Durant', 128, 'Simon & Schuster', 8, '1995-12-13', 1234567896, 1234567896000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'The Iliad', ' Homer', 704, 'Democratus', 4, '0700-01-01', 1234567897, 1234567897000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Books');
INSERT INTO Books
(item_id, title, author, pages, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'The Aeneid', ' Virgil', 464, 'Democratus', 4, '0029-01-01', 1234567898, 1234567898000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

/* ====== Insert New Magazines ====== */
/* (magazine_id, item_id, title, publisher, quantity, isbn10, isbn13) */

INSERT INTO Items (discriminator) VALUES ('Magazines');
INSERT INTO Magazines
(item_id, title, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'BMW Magazine', 'BMW', 1, '1997-05-08', 1234567899, 1234567899000
SELECT select_id, 'BMW Magazine', 'BMW', 1, '1997-05-08', 2234567890, 2234567890000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Magazines');
INSERT INTO Magazines
(item_id, title, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'Wired October', 'Wired', 2, '1998-03-03', 1234567900, 1234567900000
SELECT select_id, 'Wired October', 'Wired', 2, '1998-03-03', 2234567891, 2234567891000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Magazines');
INSERT INTO Magazines
(item_id, title, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id, 'Wired November', 'Wired', 3, '2003-11-11', 1234567901, 1234567901000
SELECT select_id, 'Wired November', 'Wired', 3, '2003-11-11', 2234567892, 2234567892000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Magazines');
INSERT INTO Magazines
(item_id, title, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id,'Wired December','Wired', 6, '2006-06-15', 1234567902, 1234567902000
SELECT select_id,'Wired December','Wired', 6, '2006-06-15', 2234567893, 2234567893000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Magazines');
INSERT INTO Magazines
(item_id, title, publisher, quantity, release_date, isbn10, isbn13)
SELECT select_id,'National Geographic','Wired', 1, '2014-04-20', 1234567903, 1234567902003
SELECT select_id,'National Geographic','Wired', 1, '2014-04-20', 2234567894, 2234567894000
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

/* ======== Insert New Movies ======= */
Expand All @@ -247,29 +265,29 @@ INSERT INTO Magazines
INSERT INTO Items (discriminator) VALUES ('Movies');
INSERT INTO Movies
(item_id, title, director, producers, language, dubbed, subtitles, actors, quantity, release_date, run_time)
SELECT select_id, 'Oceans 11', 'Clint Eastwood', 'Michael Kane',
'English', 'English', 'German', 'George Cloney, Brad Pitt', 5, '2001-09-04', 133
SELECT select_id, 'Oceans 11', 'Steven Soderbergh', 'Warner Bros',
'English', 'English', 'German', 'George Clooney, Brad Pitt, Julia Roberts', 5, '2001-09-04', 133
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Movies');
INSERT INTO Movies
(item_id, title, director, producers, language, dubbed, subtitles, actors, quantity, release_date, run_time)
SELECT select_id, 'Oceans 12', 'Clint Eastwood', 'Michael Kane',
'English', 'English', 'German', 'George Cloney, Brad Pitt', 4, '2004-09-05', 127
SELECT select_id, 'Oceans 12', 'Steven Soderbergh', 'Warner Bros',
'English', 'English', 'German', 'George Clooney, Brad Pitt, Julia Roberts', 4, '2004-09-05', 127
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Movies');
INSERT INTO Movies
(item_id, title, director, producers, language, dubbed, subtitles, actors, quantity, release_date, run_time)
SELECT select_id, 'Oceans 13', 'Clint Eastwood', 'Michael Kane',
'English', 'English', 'German', 'George Cloney, Brad Pitt', 10, '2005-09-05', 127
SELECT select_id, 'Oceans 13', 'Steven Soderbergh', 'Warner Bros',
'English', 'English', 'German', 'George Clooney, Brad Pitt, Julia Roberts', 10, '2007-09-05', 127
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Movies');
INSERT INTO Movies
(item_id, title, director, producers, language, dubbed, subtitles, actors, quantity, release_date, run_time)
SELECT select_id, 'Oceans 14', 'Clint Eastwood', 'Michael Kane',
'English', 'English', 'Spanish', 'George Cloney, Brad Pitt', 9, '2006-09-05', 127
SELECT select_id, 'Interstellar', 'Christopher Nolan', 'Paramount Pictures',
'English', 'English', 'Spanish', 'Matthew McConaughey, Anne Hathaway', 9, '2006-09-05', 127
FROM (SELECT CURRVAL('items_item_id_seq') select_id)q;

INSERT INTO Items (discriminator) VALUES ('Movies');
Expand Down

0 comments on commit cfee897

Please sign in to comment.