Mercurial > ~darius > hgwebdir.cgi > wh1080
comparison db/mkdb @ 0:9dab44dcb331
Initial commit of Greg's code from http://www.lemis.com/grog/tmp/wh1080.tar.gz
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Tue, 09 Feb 2010 13:44:25 +1030 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9dab44dcb331 |
---|---|
1 /* | |
2 * Create MySQL databases | |
3 * $Id: mkdb,v 1.3 2009/12/20 00:44:15 grog Exp grog $ | |
4 */ | |
5 create database if not exists weather; | |
6 use weather; | |
7 create table if not exists observations | |
8 (station_id char (16), | |
9 date date, | |
10 time time, | |
11 inside_humidity smallint null, /* humidity in percent */ | |
12 inside_temp float null, /* inside temperature */ | |
13 inside_dewpoint float null, /* inside dewpoint temperature */ | |
14 outside_temp float null, /* outside temperature */ | |
15 outside_dewpoint float null, /* outside dewpoint temperature */ | |
16 apparent_temp float null, /* apparent outside temperature */ | |
17 delta_t float null, /* delta to wet bulb temperature */ | |
18 outside_humidity smallint null, /* humidity in percent */ | |
19 pressure_abs float null, /* absolute pressure, hPa */ | |
20 pressure_msl float null, /* sea-level relative pressure, hPa */ | |
21 pressure_qnh float null, /* qnh pressure, hPa */ | |
22 visibility float null, | |
23 wind_direction float, /* wind direction, in 45° increments */ | |
24 wind_direction_text char (6) null, /* wind direction, text */ | |
25 wind_speed float null, /* wind speed in km/h */ | |
26 wind_gust float null, /* wind gust speed in km/h */ | |
27 rain float null, /* rainfall in mm */ | |
28 events text null, /* Not sure what this is */ | |
29 conditions text null, /* Not sure what this is */ | |
30 clouds text null, /* but what? */ | |
31 primary key (date, time, station_id)); | |
32 create table if not exists remote_observations like observations; | |
33 | |
34 /* Time of last report for this station to this remote site */ | |
35 create table if not exists lastreport | |
36 (station_id char (16), /* which station? */ | |
37 report_id char (16), /* and which remote site? */ | |
38 date timestamp, /* last report */ | |
39 primary key (station_id, report_id) | |
40 ); | |
41 | |
42 /* Configuration */ | |
43 create table if not exists config | |
44 ( version int, /* format version number */ | |
45 latitude float, /* In ° */ | |
46 longitude float, | |
47 elevation float, /* metres */ | |
48 pressure_error float, /* difference between actual and real pressure, hPa */ | |
49 poll_interval int, /* time, in seconds, between reading the device */ | |
50 station_id char (16), /* this is the one we use for the database */ | |
51 address text, /* Address to display on web pages */ | |
52 wunderground_station_id text, | |
53 wunderground_passwd text, | |
54 wunderground_report_interval int, /* how many seconds between reports to Wunderground */ | |
55 weatheforyou_station_id text, | |
56 weatheforyou_passwd text, | |
57 weatherforyou_report_interval int, /* how many seconds between reports to Weather for you */ | |
58 website_generation_interval int, /* how many seconds between generating PHP header file */ | |
59 db_host text, /* database on this host */ | |
60 db_user text, /* user ID on host */ | |
61 db_passwd text, /* and password */ | |
62 db text, /* database name */ | |
63 db_table text, /* table */ | |
64 sharefile text, /* shared segment file */ | |
65 php_header text, /* php header file with weather data */ | |
66 comparefile text, /* file to compare local weather stations */ | |
67 primary key (station_id) | |
68 ); |