CREATE TABLE wfdisk (
STA varchar (6) NOT NULL, 
CHAN varchar (8) NOT NULL, 
"time" float8 NOT NULL, 
WFID numeric NOT NULL, 
CHANID numeric NULL, 
JDATE numeric NULL, 
ENDTIME float8 NULL, 
NSAMP numeric NULL, 
SAMPRATE float8 NULL, 
CALIB float8 NULL, 
CALPER float8 NULL, 
INSTYPE varchar (6) NULL, 
SEGTYPE varchar (1) NULL, 
DATATYPE varchar (2) NULL, 
CLIP varchar (1) NULL, 
DIR varchar (64) NULL, 
DFILE varchar (32) NULL, 
FOFF numeric NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE stamag (
MAGID numeric NULL, 
AMPID numeric NULL, 
STA char (6) NOT NULL, 
ARID numeric NULL, 
ORID numeric NULL, 
EVID numeric NULL, 
PHASE char (8) NULL, 
DELTA float8 NULL, 
MAGTYPE char (6) NULL, 
MAGNITUDE float8 NULL, 
UNCERTAINTY float8 NULL, 
MAGRES float8 NULL, 
MAGDEF char (1) NULL, 
MMODEL char (15) NULL, 
AUTH char (15) NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE sitechan (
STA varchar (6) NOT NULL, 
CHAN varchar (8) NOT NULL, 
ONDATE numeric NOT NULL, 
CHANID numeric NULL, 
OFFDATE numeric NULL, 
CTYPE varchar (4) NULL, 
EDEPTH numeric NULL, 
HANG numeric NULL, 
VANG numeric NULL, 
DESCRIP varchar (50) NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE site (
STA varchar (6) NOT NULL, 
ONDATE numeric NOT NULL, 
OFFDATE numeric NULL, 
LAT float8 NULL, 
LON float8 NULL, 
ELEV float8 NULL, 
STANAME varchar (50) NULL, 
STATYPE varchar (4) NULL, 
REFSTA varchar (6) NULL, 
DNORTH float8 NULL, 
DEAST float8 NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE sensor (
STA varchar (6) NOT NULL, 
CHAN varchar (8) NOT NULL, 
"time" float8 NOT NULL, 
ENDTIME float8 NOT NULL, 
INID numeric NOT NULL, 
CHANID numeric NULL, 
JDATE numeric NULL, 
CALRATIO float8 NULL, 
CALPER float8 NULL, 
TSHIFT float8 NULL, 
INSTANT varchar (1) NOT NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE remark (
COMMID numeric NULL, 
"lineno" numeric NULL, 
REMARK varchar (80) NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE origin (
LAT float8 NOT NULL, 
LON float8 NOT NULL, 
DEPTH float8 NULL, 
"time" float8 NULL, 
ORID numeric NOT NULL, 
EVID numeric NULL, 
JDATE numeric NULL, 
NASS numeric NULL, 
NDEF numeric NULL, 
NDP numeric NULL, 
GRN numeric NULL, 
SRN numeric NULL, 
ETYPE char (7) NULL, 
DEPDP float8 NULL, 
DTYPE char (1) NULL, 
MB float8 NULL, 
MBID numeric NULL, 
MS float8 NULL, 
MSID numeric NULL, 
ML float8 NULL, 
MLID numeric NULL, 
ALGORITHM char (15) NULL, 
AUTH char (15) NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE network (
NET varchar (8) NULL, 
NETNAME varchar (80) NULL, 
NETTYPE varchar (4) NULL, 
AUTH varchar (15) NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE netmag (
MAGID numeric NOT NULL, 
NET char (8) NULL, 
ORID numeric NULL, 
EVID numeric NULL, 
MAGTYPE char (6) NULL, 
NSTA numeric NULL, 
MAGNITUDE float8 NULL, 
UNCERTAINTY float8 NULL, 
AUTH char (15) NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE lastid (
KEYNAME varchar (15) NOT NULL, 
KEYVALUE numeric NOT NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE instrument (
INID numeric NOT NULL, 
INSNAME varchar (50) NULL, 
INSTYPE varchar (6) NULL, 
BAND varchar (1) NULL, 
DIGITAL varchar (1) NULL, 
SAMPRATE float8 NULL, 
NCALIB float8 NULL, 
NCALPER float8 NULL, 
DIR varchar (64) NULL, 
DFILE varchar (32) NULL, 
RSPTYPE varchar (6) NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE assoc (
ARID numeric NULL, 
ORID numeric NULL, 
STA char (6) NULL, 
PHASE char (8) NULL, 
BELIEF float8 NULL, 
DELTA float8 NULL, 
SEAZ float8 NULL, 
ESAZ float8 NULL, 
TIMERES float8 NULL, 
TIMEDEF char (1) NULL, 
AZRES float8 NULL, 
AZDEF char (1) NULL, 
SLORES float8 NULL, 
SLODEF char (1) NULL, 
EMARES float8 NULL, 
WGT float8 NULL, 
VMODEL char (15) NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE arrival (
STA char (6) NOT NULL, 
"time" float8 NOT NULL, 
ARID numeric NOT NULL, 
JDATE numeric NULL, 
STASSID numeric NULL, 
CHANID numeric NULL, 
CHAN char (8) NULL, 
IPHASE char (8) NULL, 
STYPE char (1) NULL, 
DELTIM float8 NULL, 
AZIMUTH float8 NULL, 
DELAZ float8 NULL, 
SLOW float8 NULL, 
DELSLO float8 NULL, 
EMA float8 NULL, 
RECT float8 NULL, 
AMP float8 NULL, 
PER float8 NULL, 
LOGAT float8 NULL, 
CLIP char (1) NULL, 
FM char (2) NULL, 
SNR float8 NULL, 
QUAL char (1) NULL, 
AUTH char (15) NULL, 
COMMID numeric NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE arr_alert (
NET varchar (8) NULL, 
STA varchar (6) NULL, 
"time" float8 NULL, 
PHASE varchar (8) NULL, 
AZIMUTH float8 NULL, 
SLOW float8 NULL, 
SNR float8 NULL, 
AMP float8 NULL, 
PER float8 NULL, 
LDDATE timestamp with time zone NULL, 
SHAV float8 NULL, 
DUR float8 NULL, 
AR_ID numeric NULL, 
DATET timestamp with time zone NULL, 
DEC numeric NULL, 
JDATE numeric NULL
);

CREATE TABLE amplitude (
AMPID numeric NOT NULL, 
ARID numeric NULL, 
PARID numeric NULL, 
CHAN char (8) NULL, 
AMP float8 NULL, 
PER float8 NULL, 
SNR float8 NULL, 
AMPTIME float8 NULL, 
START_TIME float8 NULL, 
DURATION float8 NULL, 
BANDW float8 NULL, 
AMPTYPE char (8) NULL, 
UNITS char (15) NULL, 
CLIP char (1) NULL, 
INARRIVAL char (1) NULL, 
AUTH char (15) NULL, 
LDDATE timestamp with time zone NULL
);

CREATE TABLE affilation (
NET varchar (8) NULL, 
STA varchar (6) NULL, 
LDDATE timestamp with time zone NULL
);

insert into lastid values ('orid',1,'03/12/03');
insert into lastid values ('arid',1,'03/12/03');
