Skip to content

Instantly share code, notes, and snippets.

@samgiles
Last active January 20, 2017 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samgiles/f91d7312e753d745b40585b5d78692f9 to your computer and use it in GitHub Desktop.
Save samgiles/f91d7312e753d745b40585b5d78692f9 to your computer and use it in GitHub Desktop.
Initial Postgres (+PostGIS ) Schema for Journey
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
);
@arcturus
Copy link

For the poi_data table we will need some how a way of adding things that are not text.
In the mocks we had things like audio, video, or extra images coming from different places.

@wilsonpage
Copy link

FLYBY: Should we stick to user_id. Usernames could change.

@wilsonpage
Copy link

poi_data is quite vague. What is that exactly? Is it media linked to a POI?

@wilsonpage
Copy link

BIKESHED: What is interaction, is it a list of events? If so I think events 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?

@samgiles
Copy link
Author

samgiles commented Jan 20, 2017

@wilsonpage

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