Last active
January 20, 2017 15:44
-
-
Save samgiles/f91d7312e753d745b40585b5d78692f9 to your computer and use it in GitHub Desktop.
Initial Postgres (+PostGIS ) Schema for Journey
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
CREATE TABLE poi ( | |
id SERIAL PRIMARY KEY, | |
location GEOGRAPHY(POINT, 4326), | |
address TEXT | |
); | |
CREATE INDEX poi_location_index ON poi USING gist (location); | |
CREATE TABLE "user" ( | |
id SERIAL PRIMARY KEY, | |
username TEXT NOT NULL, | |
image_url TEXT | |
); | |
CREATE TABLE poi_data ( | |
poi_id INTEGER REFERENCES poi(id), | |
timestamp INTEGER, | |
data TEXT NOT NULL // points to S3 URLs with (JSON) | |
); | |
CREATE TABLE interaction ( | |
uuid TEXT NOT NULL, | |
timestamp INTEGER, | |
associated_uid INTEGER, // nullable | |
data TEXT NOT NULL | |
); |
Nope, I like pedantry in code and architecture.
events
is a better term, to stick with convention, I'll use singular event
.
poi_data
is data linked to a poi. Could be content_attachment
? That's what I had in a previous iteration.
user.id
will never change (the underlying uid for a user), user.username
can change, but must also be unique, just not the PK.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BIKESHED: What is
interaction
, is it a list ofevents
? If so I thinkevents
is a better name as not all of the items will be directly related to a users interaction. So example if a user gets close to POI we may want to record that as an event, but it's not necessarily an 'interaction'.Sorry, am I being pedantic?