view db/mkdb @ 8:e3d2b5500b53 default tip

Missed part of earlier commit to only print the query if -vv is used as well as compiling in the mysql stuff (now that I know -n DTRT)
author Daniel O'Connor <darius@dons.net.au>
date Thu, 11 Feb 2010 12:48:57 +1030
parents 9dab44dcb331
children
line wrap: on
line source

/*
 * Create MySQL databases
 * $Id: mkdb,v 1.3 2009/12/20 00:44:15 grog Exp grog $
 */
create database if not exists weather;
use weather;
create table if not exists observations
(station_id char (16),
 date date,
 time time,
 inside_humidity smallint null,                 /* humidity in percent */
 inside_temp float null,                        /* inside temperature */
 inside_dewpoint float null,                    /* inside dewpoint temperature */
 outside_temp float null,                       /* outside temperature */
 outside_dewpoint float null,                   /* outside dewpoint temperature */
 apparent_temp float null,                      /* apparent outside temperature */
 delta_t float null,                            /* delta to wet bulb temperature */
 outside_humidity smallint null,                /* humidity in percent */
 pressure_abs float null,                       /* absolute pressure, hPa */
 pressure_msl float null,                       /* sea-level relative pressure, hPa */
 pressure_qnh float null,                       /* qnh pressure, hPa */
 visibility float null,
 wind_direction float,                          /* wind direction, in 45° increments */
 wind_direction_text char (6) null,             /* wind direction, text */
 wind_speed float null,                         /* wind speed in km/h */
 wind_gust float null,                          /* wind gust speed in km/h */
 rain float null,                               /* rainfall in mm */
 events text null,                              /* Not sure what this is */
 conditions text null,                          /* Not sure what this is */
 clouds text null,                              /* but what? */
 primary key (date, time, station_id));
create table if not exists remote_observations like observations;

/* Time of last report for this station to this remote site */
create table if not exists lastreport
(station_id char (16),                          /* which station? */
 report_id char (16),                           /* and which remote site? */
 date timestamp,                                /* last report */
 primary key (station_id, report_id)
);

/* Configuration */
create table if not exists config
( version int,                                  /* format version number */
  latitude float,                               /* In ° */
  longitude float,
  elevation float,                              /* metres */
  pressure_error float,                         /* difference between actual and real pressure, hPa */
  poll_interval int,                            /* time, in seconds, between reading the device */
  station_id char (16),                              /* this is the one we use for the database */
  address text,                                 /* Address to display on web pages */
  wunderground_station_id text,
  wunderground_passwd text,
  wunderground_report_interval int,             /* how many seconds between reports to Wunderground */
  weatheforyou_station_id text,
  weatheforyou_passwd text,
  weatherforyou_report_interval int,            /* how many seconds between reports to Weather for you */
  website_generation_interval int,              /* how many seconds between generating PHP header file */
  db_host text,                                 /* database on this host */
  db_user text,                                 /* user ID on host */
  db_passwd text,                               /* and password */
  db text,                                      /* database name */
  db_table text,                                /* table */
  sharefile text,                               /* shared segment file */
  php_header text,                              /* php header file with weather data */
  comparefile text,                              /* file to compare local weather stations */
  primary key (station_id)  	      
);