album/migrations/20160708213522_create_positions_table/up.sql

13 lines
479 B
MySQL
Raw Normal View History

2016-07-09 17:04:19 +03:00
-- Rather than using floating points or DECIMAL(8,5) or something like
-- that, lat and long are stored as signed microdegrees integer values.
CREATE TABLE positions (
id SERIAL PRIMARY KEY,
photo_id INTEGER NOT NULL REFERENCES photos (id),
latitude INTEGER NOT NULL,
longitude INTEGER NOT NULL
);
CREATE INDEX positions_photo_idx ON positions (photo_id);
CREATE INDEX positions_lat_idx ON positions (latitude);
CREATE INDEX positions_long_idx ON positions (longitude);