Motion database

From Wildsong
Revision as of 05:10, 17 March 2013 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

The Motion Database is used to keep track of my rolling stock including cars and bicycles. It's a demo database for developing concepts in PostgreSQL and Wavemaker.

Table creation SQL

createdb -t template1 motion

IF EXISTS vehicle DROP TABLE vehicle CREATE TABLE vehicle (

 pk CHAR DEFAULT "V",
 vehicle_id
 name
 description
 serial_number

);

CREATE TABLE photos (

 photo_id PRIMARY KEY,
 photo
 description
 location
 fkey

);

CREATE TABLE trips (

 pk
 trip_id
 date
 mileage
 vehicle_id
 gpxlog_id
 notes

);

CREATE TABLE maintenance (

 pk CHAR DEFAULT "M",
 maint_id
 date
 description
 notes
 vehicle_id 

);

CREATE TABLE gpxlog (

 gpxlog_id PRIMARY KEY,
 upload_date DATESTAMP,
 log TEXT,
 note TEXT

);