-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated database table/view initialization to a separate script, which is runned upon starting the postgres docker container. References #58, #59, #60, #61 and #62.
- Loading branch information
1 parent
730273a
commit ef9a0ea
Showing
2 changed files
with
34 additions
and
4 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
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,30 @@ | ||
CREATE TABLE IF NOT EXISTS orders ( | ||
id UUID PRIMARY KEY, | ||
sender_id UUID NOT NULL, | ||
sender_location_latitude FLOAT8 NOT NULL, | ||
sender_location_longitude FLOAT8 NOT NULL, | ||
receiver_id UUID NOT NULL, | ||
receiver_location_latitude FLOAT8 NOT NULL, | ||
receiver_location_longitude FLOAT8 NOT NULL, | ||
source_ip TEXT NOT NULL, | ||
source_browser TEXT NOT NULL, | ||
source_referrer TEXT, | ||
created_on TIMESTAMPTZ NOT NULL | ||
); | ||
|
||
|
||
DROP VIEW IF EXISTS orders_view; | ||
CREATE VIEW orders_view AS | ||
SELECT | ||
a.id, | ||
a.sender_id as senderId, | ||
a.sender_location_latitude AS senderLocationLatitude, | ||
a.sender_location_longitude AS senderLocationLongitude, | ||
a.receiver_id AS receiverId, | ||
a.receiver_location_latitude AS receiverLocationLatitude, | ||
a.receiver_location_longitude AS receiverLocationLongitude, | ||
a.source_ip AS sourceIp, | ||
a.source_browser AS sourceBrowser, | ||
a.source_referrer AS sourceReferrer, | ||
a.created_on AS createdOn | ||
FROM orders as a |