-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related #1 Co-authored-by: sakireid <[email protected]>
- Loading branch information
Showing
4 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
BEGIN; | ||
|
||
DROP TABLE IF EXISTS user_table, sessions_table, itineraries_table, imgs_table, mapspoints_table, reviews_table CASCADE; | ||
|
||
CREATE TABLE user_table ( | ||
id SERIAL PRIMARY KEY, | ||
username TEXT UNIQUE NOT NULL, | ||
email TEXT UNIQUE NOT NULL, | ||
password TEXT NOT NULL | ||
); | ||
|
||
CREATE TABLE sessions_table ( | ||
sid TEXT PRIMARY KEY, | ||
data JSON NOT NULL | ||
); | ||
|
||
CREATE TABLE itineraries_table ( | ||
id SERIAL PRIMARY KEY, | ||
user_id INTEGER REFERENCES user_table(id) ON DELETE CASCADE, | ||
name TEXT NOT NULL, | ||
country TEXT NOT NULL, | ||
need_car BOOLEAN NOT NULL, | ||
budget DECIMAL, | ||
duration INTEGER NOT NULL, | ||
description JSON NOT NULL, | ||
created_at TIMESTAMP | ||
); | ||
|
||
|
||
CREATE TABLE imgs_table ( | ||
id SERIAL PRIMARY KEY, | ||
itinerary_id INTEGER REFERENCES itineraries_table(id) ON DELETE CASCADE, | ||
img BYTEA | ||
); | ||
|
||
CREATE TABLE mapspoints_table ( | ||
id SERIAL PRIMARY KEY, | ||
user_id INTEGER REFERENCES user_table(id) ON DELETE CASCADE, | ||
itinerary_id INTEGER REFERENCES itineraries_table(id) ON DELETE CASCADE, | ||
name TEXT NOT NULL, | ||
longitude DECIMAL, | ||
latitude DECIMAL | ||
); | ||
|
||
|
||
CREATE TABLE reviews_table ( | ||
id SERIAL PRIMARY KEY, | ||
user_id INTEGER REFERENCES user_table(id) ON DELETE CASCADE, | ||
stars INTEGER NOT NULL, | ||
review TEXT NOT NULL, | ||
itinerary_id INTEGER REFERENCES itineraries_table(id) ON DELETE CASCADE, | ||
created_at TIMESTAMP | ||
); | ||
|
||
INSERT INTO user_table (email, password, username) VALUES | ||
( | ||
'[email protected]', | ||
'$2a$10$vzgLAxSa1k293giKSbVWi.GgSGmb1JB/kD1qWIg.mrUlt7UwVDCWG', | ||
'Test Testington' | ||
); | ||
|
||
INSERT INTO sessions_table (sid, data) VALUES | ||
( | ||
'abc123', | ||
'{"test":"stuff"}' | ||
); | ||
|
||
INSERT INTO itineraries_table ( user_id, name, country, need_car, budget, duration, description, created_at) VALUES | ||
(1, 'Southwest England', 'England', TRUE, 1400, 10, '{"description": "Day One- Oxford, Stratford Upon Avon Day Two: Cotswolds Day Three: Bath, Wells, Glastonbury Day Four: Exmoor National Park, Croyde Bay, (Barnstaple), Bude Day Five: Cornwall- Tintagel, Saint Michael’s Mount, Land’s End, Minack Theatre, Mousehole Day Six: Lizard Point, Pendennis Castle, Dartmoor National Park, Exeter Day Seven: Beer, Seaton Down, Lyme Regis, Durdle Door, Lulworth Cove Day Eight: Portsmouth, Arundel, Brighton Day Nine: Brighton, Beachy Head, Rye Day ten: Rye, White Cliffs of Dover, Canterbury"}', (SELECT CURRENT_TIMESTAMP)); | ||
|
||
COMMIT; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ | |
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-react": "^7.24.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters