Motion database: Difference between revisions
From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs) m Created page with '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. [[Catego…' |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
The Motion Database is used to keep track of my rolling stock including cars and bicycles. | 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]]. | 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 | |||
); | |||
[[Category: SQL]] | [[Category: SQL]] |
Revision as of 05:10, 17 March 2013
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
);