[seiscomp, scanloc] Install, add .gitignore
This commit is contained in:
92
share/db/migrations/mysql/0_10_to_0_11.sql
Normal file
92
share/db/migrations/mysql/0_10_to_0_11.sql
Normal file
@ -0,0 +1,92 @@
|
||||
SELECT 'Add StationMagnitude.passedQC' AS '';
|
||||
ALTER TABLE StationMagnitude ADD passedQC TINYINT(1) AFTER waveformID_used;
|
||||
|
||||
SELECT 'Creating DataAvailability PublicObject entry' AS '';
|
||||
INSERT INTO Object(_oid) VALUES (NULL);
|
||||
INSERT INTO PublicObject(_oid,publicID) VALUES (LAST_INSERT_ID(),'DataAvailability');
|
||||
|
||||
SELECT 'Creating DataSegment' AS '';
|
||||
CREATE TABLE DataSegment (
|
||||
_oid INTEGER(11) NOT NULL,
|
||||
_parent_oid INTEGER(11) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
start DATETIME NOT NULL,
|
||||
start_ms INTEGER NOT NULL,
|
||||
end DATETIME NOT NULL,
|
||||
end_ms INTEGER NOT NULL,
|
||||
updated DATETIME NOT NULL,
|
||||
updated_ms INTEGER NOT NULL,
|
||||
sampleRate DOUBLE NOT NULL,
|
||||
quality VARCHAR(8) NOT NULL,
|
||||
outOfOrder TINYINT(1) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(_parent_oid),
|
||||
INDEX(start,start_ms),
|
||||
INDEX(end,end_ms),
|
||||
INDEX(updated,updated_ms),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE KEY composite_index (_parent_oid,start,start_ms)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
SELECT 'Creating DataAttributeExtent' AS '';
|
||||
CREATE TABLE DataAttributeExtent (
|
||||
_oid INTEGER(11) NOT NULL,
|
||||
_parent_oid INTEGER(11) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
start DATETIME NOT NULL,
|
||||
start_ms INTEGER NOT NULL,
|
||||
end DATETIME NOT NULL,
|
||||
end_ms INTEGER NOT NULL,
|
||||
sampleRate DOUBLE NOT NULL,
|
||||
quality VARCHAR(8) NOT NULL,
|
||||
updated DATETIME NOT NULL,
|
||||
updated_ms INTEGER NOT NULL,
|
||||
segmentCount INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(_parent_oid),
|
||||
INDEX(start,start_ms),
|
||||
INDEX(end,end_ms),
|
||||
INDEX(updated,updated_ms),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE KEY composite_index (_parent_oid,sampleRate,quality)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
SELECT 'Creating DataExtent' AS '';
|
||||
CREATE TABLE DataExtent (
|
||||
_oid INTEGER(11) NOT NULL,
|
||||
_parent_oid INTEGER(11) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
waveformID_networkCode CHAR(8) NOT NULL,
|
||||
waveformID_stationCode CHAR(8) NOT NULL,
|
||||
waveformID_locationCode CHAR(8),
|
||||
waveformID_channelCode CHAR(8),
|
||||
waveformID_resourceURI VARCHAR(255),
|
||||
start DATETIME NOT NULL,
|
||||
start_ms INTEGER NOT NULL,
|
||||
end DATETIME NOT NULL,
|
||||
end_ms INTEGER NOT NULL,
|
||||
updated DATETIME NOT NULL,
|
||||
updated_ms INTEGER NOT NULL,
|
||||
lastScan DATETIME NOT NULL,
|
||||
lastScan_ms INTEGER NOT NULL,
|
||||
segmentOverflow TINYINT(1) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(_parent_oid),
|
||||
INDEX(waveformID_resourceURI),
|
||||
INDEX(start,start_ms),
|
||||
INDEX(end,end_ms),
|
||||
INDEX(updated,updated_ms),
|
||||
INDEX(lastScan,lastScan_ms),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE KEY composite_index (_parent_oid,waveformID_networkCode,waveformID_stationCode,waveformID_locationCode,waveformID_channelCode,waveformID_resourceURI)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
SELECT 'Updating Meta' AS '';
|
||||
UPDATE Meta SET value='0.11' WHERE name='Schema-Version';
|
||||
|
5
share/db/migrations/mysql/0_11_to_0_12.sql
Normal file
5
share/db/migrations/mysql/0_11_to_0_12.sql
Normal file
@ -0,0 +1,5 @@
|
||||
SELECT 'Add Origin.confidenceLevel' AS '';
|
||||
ALTER TABLE Origin ADD uncertainty_confidenceLevel DOUBLE UNSIGNED AFTER uncertainty_preferredDescription;
|
||||
|
||||
SELECT 'Updating Meta' AS '';
|
||||
UPDATE Meta SET value='0.12' WHERE name='Schema-Version';
|
2
share/db/migrations/mysql/0_12_1_to_0_13.sql
Normal file
2
share/db/migrations/mysql/0_12_1_to_0_13.sql
Normal file
@ -0,0 +1,2 @@
|
||||
SELECT 'Updating Meta' AS '';
|
||||
UPDATE Meta SET value='0.13' WHERE name='Schema-Version';
|
5
share/db/migrations/mysql/0_12_to_0_12_1.sql
Normal file
5
share/db/migrations/mysql/0_12_to_0_12_1.sql
Normal file
@ -0,0 +1,5 @@
|
||||
SELECT 'Convert JournalEntry.parameters to BLOB' AS '';
|
||||
ALTER TABLE JournalEntry MODIFY parameters blob;
|
||||
|
||||
SELECT 'Updating Meta' AS '';
|
||||
UPDATE Meta SET value='0.12.1' WHERE name='Schema-Version';
|
8
share/db/migrations/mysql/0_13_to_0_13_2.sql
Normal file
8
share/db/migrations/mysql/0_13_to_0_13_2.sql
Normal file
@ -0,0 +1,8 @@
|
||||
SELECT 'Convert Comment.text to LONGTEXT' AS '';
|
||||
ALTER TABLE Comment MODIFY text LONGTEXT;
|
||||
|
||||
SELECT 'Convert JournalEntry.parameters to LONGTEXT' AS '';
|
||||
ALTER TABLE JournalEntry MODIFY parameters LONGTEXT;
|
||||
|
||||
SELECT 'Updating Meta' AS '';
|
||||
UPDATE Meta SET value='0.13.2' WHERE name='Schema-Version';
|
21
share/db/migrations/mysql/0_7_to_0_8.sql
Normal file
21
share/db/migrations/mysql/0_7_to_0_8.sql
Normal file
@ -0,0 +1,21 @@
|
||||
CREATE TABLE ResponseFAP (
|
||||
_oid INTEGER(11) NOT NULL,
|
||||
_parent_oid INTEGER(11) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
name VARCHAR(255),
|
||||
gain DOUBLE UNSIGNED,
|
||||
gainFrequency DOUBLE UNSIGNED,
|
||||
numberOfTuples SMALLINT UNSIGNED,
|
||||
tuples_content BLOB,
|
||||
tuples_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
remark_content BLOB,
|
||||
remark_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(_parent_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE(_parent_oid,name)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
UPDATE Meta SET value='0.8' WHERE name='Schema-Version';
|
12
share/db/migrations/mysql/0_8_to_0_9.sql
Normal file
12
share/db/migrations/mysql/0_8_to_0_9.sql
Normal file
@ -0,0 +1,12 @@
|
||||
ALTER TABLE ConfigStation ADD creationInfo_agencyID VARCHAR(64);
|
||||
ALTER TABLE ConfigStation ADD creationInfo_agencyURI VARCHAR(255);
|
||||
ALTER TABLE ConfigStation ADD creationInfo_author VARCHAR(128);
|
||||
ALTER TABLE ConfigStation ADD creationInfo_authorURI VARCHAR(255);
|
||||
ALTER TABLE ConfigStation ADD creationInfo_creationTime DATETIME;
|
||||
ALTER TABLE ConfigStation ADD creationInfo_creationTime_ms INTEGER;
|
||||
ALTER TABLE ConfigStation ADD creationInfo_modificationTime DATETIME;
|
||||
ALTER TABLE ConfigStation ADD creationInfo_modificationTime_ms INTEGER;
|
||||
ALTER TABLE ConfigStation ADD creationInfo_version VARCHAR(64);
|
||||
ALTER TABLE ConfigStation ADD creationInfo_used TINYINT(1) NOT NULL DEFAULT '0';
|
||||
|
||||
UPDATE Meta SET value='0.9' WHERE name='Schema-Version';
|
406
share/db/migrations/mysql/0_9_to_0_10.sql
Normal file
406
share/db/migrations/mysql/0_9_to_0_10.sql
Normal file
@ -0,0 +1,406 @@
|
||||
SELECT 'Creating ResponseIIR' AS '';
|
||||
CREATE TABLE ResponseIIR (
|
||||
_oid INTEGER(11) NOT NULL,
|
||||
_parent_oid INTEGER(11) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
name VARCHAR(255),
|
||||
type CHAR(1),
|
||||
gain DOUBLE,
|
||||
gainFrequency DOUBLE UNSIGNED,
|
||||
decimationFactor SMALLINT UNSIGNED,
|
||||
delay DOUBLE UNSIGNED,
|
||||
correction DOUBLE,
|
||||
numberOfNumerators TINYINT UNSIGNED,
|
||||
numberOfDenominators TINYINT UNSIGNED,
|
||||
numerators_content BLOB,
|
||||
numerators_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
denominators_content BLOB,
|
||||
denominators_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
remark_content BLOB,
|
||||
remark_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(_parent_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE KEY composite_index (_parent_oid,name)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
SELECT 'Updating Comment' AS '';
|
||||
ALTER TABLE Comment
|
||||
ADD start DATETIME AFTER id,
|
||||
ADD start_ms INTEGER AFTER start,
|
||||
ADD end DATETIME AFTER start_ms,
|
||||
ADD end_ms INTEGER AFTER end;
|
||||
DROP INDEX _parent_oid_2 ON Comment;
|
||||
ALTER TABLE Comment ADD CONSTRAINT composite_index UNIQUE(_parent_oid,id);
|
||||
|
||||
SELECT 'Updating StationGroup' AS '';
|
||||
ALTER TABLE StationGroup
|
||||
ADD start_ms INTEGER AFTER start,
|
||||
ADD end_ms INTEGER AFTER end;
|
||||
UPDATE StationGroup SET start_ms=0 WHERE start != NULL;
|
||||
UPDATE StationGroup SET end_ms=0 WHERE end != NULL;
|
||||
|
||||
SELECT 'Updating DataloggerCalibration' AS '';
|
||||
ALTER TABLE DataloggerCalibration
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end,
|
||||
MODIFY gain DOUBLE;
|
||||
ALTER TABLE DataloggerCalibration ALTER start_ms DROP DEFAULT;
|
||||
UPDATE DataloggerCalibration SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON DataloggerCalibration;
|
||||
ALTER TABLE DataloggerCalibration ADD CONSTRAINT composite_index UNIQUE(_parent_oid,serialNumber,channel,start,start_ms);
|
||||
|
||||
SELECT 'Updating SensorCalibration' AS '';
|
||||
ALTER TABLE SensorCalibration
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end,
|
||||
MODIFY gain DOUBLE;
|
||||
ALTER TABLE SensorCalibration ALTER start_ms DROP DEFAULT;
|
||||
UPDATE SensorCalibration SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON SensorCalibration;
|
||||
ALTER TABLE SensorCalibration ADD CONSTRAINT composite_index UNIQUE(_parent_oid,serialNumber,channel,start,start_ms);
|
||||
|
||||
SELECT 'Updating AuxStream' AS '';
|
||||
ALTER TABLE AuxStream
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end,
|
||||
MODIFY format VARCHAR(50);
|
||||
ALTER TABLE AuxStream ALTER start_ms DROP DEFAULT;
|
||||
UPDATE AuxStream SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON AuxStream;
|
||||
ALTER TABLE AuxStream ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code,start,start_ms);
|
||||
|
||||
SELECT 'Updating Stream' AS '';
|
||||
ALTER TABLE Stream
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end,
|
||||
MODIFY format VARCHAR(50);
|
||||
ALTER TABLE Stream ALTER start_ms DROP DEFAULT;
|
||||
UPDATE Stream SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON Stream;
|
||||
ALTER TABLE Stream ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code,start,start_ms);
|
||||
|
||||
SELECT 'Updating SensorLocation' AS '';
|
||||
ALTER TABLE SensorLocation
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end;
|
||||
ALTER TABLE SensorLocation ALTER start_ms DROP DEFAULT;
|
||||
UPDATE SensorLocation SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON SensorLocation;
|
||||
ALTER TABLE SensorLocation ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code,start,start_ms);
|
||||
|
||||
SELECT 'Updating Station' AS '';
|
||||
ALTER TABLE Station
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end,
|
||||
MODIFY description VARCHAR(255);
|
||||
ALTER TABLE Station ALTER start_ms DROP DEFAULT;
|
||||
UPDATE Station SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON Station;
|
||||
ALTER TABLE Station ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code,start,start_ms);
|
||||
|
||||
SELECT 'Updating Network' AS '';
|
||||
ALTER TABLE Network
|
||||
ADD start_ms INTEGER NOT NULL DEFAULT '0' AFTER start,
|
||||
ADD end_ms INTEGER AFTER end,
|
||||
MODIFY description VARCHAR(255);
|
||||
ALTER TABLE Network ALTER start_ms DROP DEFAULT;
|
||||
UPDATE Network SET end_ms=0 WHERE end != NULL;
|
||||
DROP INDEX _parent_oid_2 ON Network;
|
||||
ALTER TABLE Network ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code,start,start_ms);
|
||||
|
||||
SELECT 'Updating ResponseFIR' AS '';
|
||||
ALTER TABLE ResponseFIR
|
||||
MODIFY gain double,
|
||||
ADD gainFrequency DOUBLE UNSIGNED AFTER gain;
|
||||
DROP INDEX _parent_oid_2 ON ResponseFIR;
|
||||
ALTER TABLE ResponseFIR ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating ResponsePAZ' AS '';
|
||||
ALTER TABLE ResponsePAZ
|
||||
ADD decimationFactor SMALLINT UNSIGNED,
|
||||
ADD delay DOUBLE UNSIGNED,
|
||||
ADD correction DOUBLE,
|
||||
MODIFY gain DOUBLE;
|
||||
DROP INDEX _parent_oid_2 ON ResponsePAZ;
|
||||
ALTER TABLE ResponsePAZ ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating ResponsePolynomial' AS '';
|
||||
ALTER TABLE ResponsePolynomial
|
||||
MODIFY gain DOUBLE,
|
||||
MODIFY approximationLowerBound DOUBLE,
|
||||
MODIFY approximationUpperBound DOUBLE;
|
||||
DROP INDEX _parent_oid_2 ON ResponsePolynomial;
|
||||
ALTER TABLE ResponsePolynomial ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating ResponseFAP' AS '';
|
||||
ALTER TABLE ResponseFAP MODIFY gain DOUBLE;
|
||||
DROP INDEX _parent_oid_2 ON ResponseFAP;
|
||||
ALTER TABLE ResponseFAP ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating Datalogger' AS '';
|
||||
ALTER TABLE Datalogger
|
||||
MODIFY gain DOUBLE,
|
||||
MODIFY description VARCHAR(255);
|
||||
DROP INDEX _parent_oid_2 ON Datalogger;
|
||||
ALTER TABLE Datalogger ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating StationGroup' AS '';
|
||||
ALTER TABLE StationGroup
|
||||
MODIFY code CHAR(20),
|
||||
MODIFY description VARCHAR(255);
|
||||
DROP INDEX _parent_oid_2 ON StationGroup;
|
||||
ALTER TABLE StationGroup ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code);
|
||||
|
||||
SELECT 'Updating AuxSource' AS '';
|
||||
ALTER TABLE AuxSource
|
||||
MODIFY name VARCHAR(255) NOT NULL,
|
||||
MODIFY description VARCHAR(255);
|
||||
DROP INDEX _parent_oid_2 ON AuxSource;
|
||||
ALTER TABLE AuxSource ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating AuxDevice' AS '';
|
||||
ALTER TABLE AuxDevice
|
||||
MODIFY name VARCHAR(255) NOT NULL,
|
||||
MODIFY description VARCHAR(255);
|
||||
DROP INDEX _parent_oid_2 ON AuxDevice;
|
||||
ALTER TABLE AuxDevice ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating Sensor' AS '';
|
||||
ALTER TABLE Sensor MODIFY name VARCHAR(255) NOT NULL;
|
||||
DROP INDEX _parent_oid_2 ON Sensor;
|
||||
ALTER TABLE Sensor ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating CompositeTime' AS '';
|
||||
ALTER TABLE CompositeTime
|
||||
ADD second_pdf_variable_content BLOB AFTER second_confidenceLevel,
|
||||
ADD second_pdf_probability_content BLOB AFTER second_pdf_variable_content,
|
||||
ADD second_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER second_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating MomentTensor' AS '';
|
||||
ALTER TABLE MomentTensor
|
||||
ADD scalarMoment_pdf_variable_content BLOB AFTER scalarMoment_confidenceLevel,
|
||||
ADD scalarMoment_pdf_probability_content BLOB AFTER scalarMoment_pdf_variable_content,
|
||||
ADD scalarMoment_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER scalarMoment_pdf_probability_content,
|
||||
ADD tensor_Mrr_pdf_variable_content BLOB AFTER tensor_Mrr_confidenceLevel,
|
||||
ADD tensor_Mrr_pdf_probability_content BLOB AFTER tensor_Mrr_pdf_variable_content,
|
||||
ADD tensor_Mrr_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER tensor_Mrr_pdf_probability_content,
|
||||
ADD tensor_Mtt_pdf_variable_content BLOB AFTER tensor_Mtt_confidenceLevel,
|
||||
ADD tensor_Mtt_pdf_probability_content BLOB AFTER tensor_Mtt_pdf_variable_content,
|
||||
ADD tensor_Mtt_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER tensor_Mtt_pdf_probability_content,
|
||||
ADD tensor_Mpp_pdf_variable_content BLOB AFTER tensor_Mpp_confidenceLevel,
|
||||
ADD tensor_Mpp_pdf_probability_content BLOB AFTER tensor_Mpp_pdf_variable_content,
|
||||
ADD tensor_Mpp_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER tensor_Mpp_pdf_probability_content,
|
||||
ADD tensor_Mrt_pdf_variable_content BLOB AFTER tensor_Mrt_confidenceLevel,
|
||||
ADD tensor_Mrt_pdf_probability_content BLOB AFTER tensor_Mrt_pdf_variable_content,
|
||||
ADD tensor_Mrt_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER tensor_Mrt_pdf_probability_content,
|
||||
ADD tensor_Mrp_pdf_variable_content BLOB AFTER tensor_Mrp_confidenceLevel,
|
||||
ADD tensor_Mrp_pdf_probability_content BLOB AFTER tensor_Mrp_pdf_variable_content,
|
||||
ADD tensor_Mrp_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER tensor_Mrp_pdf_probability_content,
|
||||
ADD tensor_Mtp_pdf_variable_content BLOB AFTER tensor_Mtp_confidenceLevel,
|
||||
ADD tensor_Mtp_pdf_probability_content BLOB AFTER tensor_Mtp_pdf_variable_content,
|
||||
ADD tensor_Mtp_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER tensor_Mtp_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating FocalMechanism' AS '';
|
||||
ALTER TABLE FocalMechanism
|
||||
ADD nodalPlanes_nodalPlane1_strike_pdf_variable_content BLOB AFTER nodalPlanes_nodalPlane1_strike_confidenceLevel,
|
||||
ADD nodalPlanes_nodalPlane1_strike_pdf_probability_content BLOB AFTER nodalPlanes_nodalPlane1_strike_pdf_variable_content,
|
||||
ADD nodalPlanes_nodalPlane1_strike_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER nodalPlanes_nodalPlane1_strike_pdf_probability_content,
|
||||
ADD nodalPlanes_nodalPlane1_dip_pdf_variable_content BLOB AFTER nodalPlanes_nodalPlane1_dip_confidenceLevel,
|
||||
ADD nodalPlanes_nodalPlane1_dip_pdf_probability_content BLOB AFTER nodalPlanes_nodalPlane1_dip_pdf_variable_content,
|
||||
ADD nodalPlanes_nodalPlane1_dip_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER nodalPlanes_nodalPlane1_dip_pdf_probability_content,
|
||||
ADD nodalPlanes_nodalPlane1_rake_pdf_variable_content BLOB AFTER nodalPlanes_nodalPlane1_rake_confidenceLevel,
|
||||
ADD nodalPlanes_nodalPlane1_rake_pdf_probability_content BLOB AFTER nodalPlanes_nodalPlane1_rake_pdf_variable_content,
|
||||
ADD nodalPlanes_nodalPlane1_rake_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER nodalPlanes_nodalPlane1_rake_pdf_probability_content,
|
||||
ADD nodalPlanes_nodalPlane2_strike_pdf_variable_content BLOB AFTER nodalPlanes_nodalPlane2_strike_confidenceLevel,
|
||||
ADD nodalPlanes_nodalPlane2_strike_pdf_probability_content BLOB AFTER nodalPlanes_nodalPlane2_strike_pdf_variable_content,
|
||||
ADD nodalPlanes_nodalPlane2_strike_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER nodalPlanes_nodalPlane2_strike_pdf_probability_content,
|
||||
ADD nodalPlanes_nodalPlane2_dip_pdf_variable_content BLOB AFTER nodalPlanes_nodalPlane2_dip_confidenceLevel,
|
||||
ADD nodalPlanes_nodalPlane2_dip_pdf_probability_content BLOB AFTER nodalPlanes_nodalPlane2_dip_pdf_variable_content,
|
||||
ADD nodalPlanes_nodalPlane2_dip_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER nodalPlanes_nodalPlane2_dip_pdf_probability_content,
|
||||
ADD nodalPlanes_nodalPlane2_rake_pdf_variable_content BLOB AFTER nodalPlanes_nodalPlane2_rake_confidenceLevel,
|
||||
ADD nodalPlanes_nodalPlane2_rake_pdf_probability_content BLOB AFTER nodalPlanes_nodalPlane2_rake_pdf_variable_content,
|
||||
ADD nodalPlanes_nodalPlane2_rake_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER nodalPlanes_nodalPlane2_rake_pdf_probability_content,
|
||||
ADD principalAxes_tAxis_azimuth_pdf_variable_content BLOB AFTER principalAxes_tAxis_azimuth_confidenceLevel,
|
||||
ADD principalAxes_tAxis_azimuth_pdf_probability_content BLOB AFTER principalAxes_tAxis_azimuth_pdf_variable_content,
|
||||
ADD principalAxes_tAxis_azimuth_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_tAxis_azimuth_pdf_probability_content,
|
||||
ADD principalAxes_tAxis_plunge_pdf_variable_content BLOB AFTER principalAxes_tAxis_plunge_confidenceLevel,
|
||||
ADD principalAxes_tAxis_plunge_pdf_probability_content BLOB AFTER principalAxes_tAxis_plunge_pdf_variable_content,
|
||||
ADD principalAxes_tAxis_plunge_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_tAxis_plunge_pdf_probability_content,
|
||||
ADD principalAxes_tAxis_length_pdf_variable_content BLOB AFTER principalAxes_tAxis_length_confidenceLevel,
|
||||
ADD principalAxes_tAxis_length_pdf_probability_content BLOB AFTER principalAxes_tAxis_length_pdf_variable_content,
|
||||
ADD principalAxes_tAxis_length_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_tAxis_length_pdf_probability_content,
|
||||
ADD principalAxes_pAxis_azimuth_pdf_variable_content BLOB AFTER principalAxes_pAxis_azimuth_confidenceLevel,
|
||||
ADD principalAxes_pAxis_azimuth_pdf_probability_content BLOB AFTER principalAxes_pAxis_azimuth_pdf_variable_content,
|
||||
ADD principalAxes_pAxis_azimuth_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_pAxis_azimuth_pdf_probability_content,
|
||||
ADD principalAxes_pAxis_plunge_pdf_variable_content BLOB AFTER principalAxes_pAxis_plunge_confidenceLevel,
|
||||
ADD principalAxes_pAxis_plunge_pdf_probability_content BLOB AFTER principalAxes_pAxis_plunge_pdf_variable_content,
|
||||
ADD principalAxes_pAxis_plunge_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_pAxis_plunge_pdf_probability_content,
|
||||
ADD principalAxes_pAxis_length_pdf_variable_content BLOB AFTER principalAxes_pAxis_length_confidenceLevel,
|
||||
ADD principalAxes_pAxis_length_pdf_probability_content BLOB AFTER principalAxes_pAxis_length_pdf_variable_content,
|
||||
ADD principalAxes_pAxis_length_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_pAxis_length_pdf_probability_content,
|
||||
ADD principalAxes_nAxis_azimuth_pdf_variable_content BLOB AFTER principalAxes_nAxis_azimuth_confidenceLevel,
|
||||
ADD principalAxes_nAxis_azimuth_pdf_probability_content BLOB AFTER principalAxes_nAxis_azimuth_pdf_variable_content,
|
||||
ADD principalAxes_nAxis_azimuth_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_nAxis_azimuth_pdf_probability_content,
|
||||
ADD principalAxes_nAxis_plunge_pdf_variable_content BLOB AFTER principalAxes_nAxis_plunge_confidenceLevel,
|
||||
ADD principalAxes_nAxis_plunge_pdf_probability_content BLOB AFTER principalAxes_nAxis_plunge_pdf_variable_content,
|
||||
ADD principalAxes_nAxis_plunge_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_nAxis_plunge_pdf_probability_content,
|
||||
ADD principalAxes_nAxis_length_pdf_variable_content BLOB AFTER principalAxes_nAxis_length_confidenceLevel,
|
||||
ADD principalAxes_nAxis_length_pdf_probability_content BLOB AFTER principalAxes_nAxis_length_pdf_variable_content,
|
||||
ADD principalAxes_nAxis_length_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER principalAxes_nAxis_length_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating Amplitude' AS '';
|
||||
ALTER TABLE Amplitude
|
||||
ADD amplitude_pdf_variable_content BLOB AFTER amplitude_confidenceLevel,
|
||||
ADD amplitude_pdf_probability_content BLOB AFTER amplitude_pdf_variable_content,
|
||||
ADD amplitude_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER amplitude_pdf_probability_content,
|
||||
ADD period_pdf_variable_content BLOB AFTER period_confidenceLevel,
|
||||
ADD period_pdf_probability_content BLOB AFTER period_pdf_variable_content,
|
||||
ADD period_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER period_pdf_probability_content,
|
||||
ADD scalingTime_pdf_variable_content BLOB AFTER scalingTime_confidenceLevel,
|
||||
ADD scalingTime_pdf_probability_content BLOB AFTER scalingTime_pdf_variable_content,
|
||||
ADD scalingTime_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER scalingTime_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating Magnitude' AS '';
|
||||
ALTER TABLE Magnitude
|
||||
ADD magnitude_pdf_variable_content BLOB AFTER magnitude_confidenceLevel,
|
||||
ADD magnitude_pdf_probability_content BLOB AFTER magnitude_pdf_variable_content,
|
||||
ADD magnitude_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER magnitude_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating StationMagnitude' AS '';
|
||||
ALTER TABLE StationMagnitude
|
||||
ADD magnitude_pdf_variable_content BLOB AFTER magnitude_confidenceLevel,
|
||||
ADD magnitude_pdf_probability_content BLOB AFTER magnitude_pdf_variable_content,
|
||||
ADD magnitude_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER magnitude_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating Pick' AS '';
|
||||
ALTER TABLE Pick
|
||||
ADD time_pdf_variable_content BLOB AFTER time_confidenceLevel,
|
||||
ADD time_pdf_probability_content BLOB AFTER time_pdf_variable_content,
|
||||
ADD time_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER time_pdf_probability_content,
|
||||
ADD horizontalSlowness_pdf_variable_content BLOB AFTER horizontalSlowness_confidenceLevel,
|
||||
ADD horizontalSlowness_pdf_probability_content BLOB AFTER horizontalSlowness_pdf_variable_content,
|
||||
ADD horizontalSlowness_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER horizontalSlowness_pdf_probability_content,
|
||||
ADD backazimuth_pdf_variable_content BLOB AFTER backazimuth_confidenceLevel,
|
||||
ADD backazimuth_pdf_probability_content BLOB AFTER backazimuth_pdf_variable_content,
|
||||
ADD backazimuth_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER backazimuth_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating Origin' AS '';
|
||||
ALTER TABLE Origin
|
||||
ADD time_pdf_variable_content BLOB AFTER time_confidenceLevel,
|
||||
ADD time_pdf_probability_content BLOB AFTER time_pdf_variable_content,
|
||||
ADD time_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER time_pdf_probability_content,
|
||||
ADD latitude_pdf_variable_content BLOB AFTER latitude_confidenceLevel,
|
||||
ADD latitude_pdf_probability_content BLOB AFTER latitude_pdf_variable_content,
|
||||
ADD latitude_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER latitude_pdf_probability_content,
|
||||
ADD longitude_pdf_variable_content BLOB AFTER longitude_confidenceLevel,
|
||||
ADD longitude_pdf_probability_content BLOB AFTER longitude_pdf_variable_content,
|
||||
ADD longitude_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER longitude_pdf_probability_content,
|
||||
ADD depth_pdf_variable_content BLOB AFTER depth_confidenceLevel,
|
||||
ADD depth_pdf_probability_content BLOB AFTER depth_pdf_variable_content,
|
||||
ADD depth_pdf_used TINYINT(1) NOT NULL DEFAULT '0' AFTER depth_pdf_probability_content;
|
||||
|
||||
SELECT 'Updating Access' AS '';
|
||||
DROP INDEX _parent_oid_2 ON Access;
|
||||
ALTER TABLE Access ADD CONSTRAINT composite_index UNIQUE(_parent_oid,networkCode,stationCode,locationCode,streamCode,user,start);
|
||||
|
||||
SELECT 'Updating AmplitudeReference' AS '';
|
||||
DROP INDEX _parent_oid_2 ON AmplitudeReference;
|
||||
ALTER TABLE AmplitudeReference ADD CONSTRAINT composite_index UNIQUE(_parent_oid,amplitudeID);
|
||||
|
||||
SELECT 'Updating ArclinkRequest' AS '';
|
||||
DROP INDEX _parent_oid_2 ON ArclinkRequest;
|
||||
ALTER TABLE ArclinkRequest ADD CONSTRAINT composite_index UNIQUE(_parent_oid,created,created_ms,requestID,userID);
|
||||
|
||||
SELECT 'Updating ArclinkRequestLine' AS '';
|
||||
DROP INDEX _parent_oid_2 ON ArclinkRequestLine;
|
||||
ALTER TABLE ArclinkRequestLine ADD CONSTRAINT composite_index UNIQUE(_parent_oid,start,start_ms,end,end_ms,streamID_networkCode,streamID_stationCode,streamID_locationCode,streamID_channelCode,streamID_resourceURI);
|
||||
|
||||
SELECT 'Updating ArclinkStatusLine' AS '';
|
||||
DROP INDEX _parent_oid_2 ON ArclinkStatusLine;
|
||||
ALTER TABLE ArclinkStatusLine ADD CONSTRAINT composite_index UNIQUE(_parent_oid,volumeID,type,status);
|
||||
|
||||
SELECT 'Updating ArclinkUser' AS '';
|
||||
DROP INDEX _parent_oid_2 ON ArclinkUser;
|
||||
ALTER TABLE ArclinkUser ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name,email);
|
||||
|
||||
SELECT 'Updating Arrival' AS '';
|
||||
DROP INDEX _parent_oid_2 ON Arrival;
|
||||
ALTER TABLE Arrival ADD CONSTRAINT composite_index UNIQUE(_parent_oid,pickID);
|
||||
|
||||
SELECT 'Updating ConfigStation' AS '';
|
||||
DROP INDEX _parent_oid_2 ON ConfigStation;
|
||||
ALTER TABLE ConfigStation ADD CONSTRAINT composite_index UNIQUE(_parent_oid,networkCode,stationCode);
|
||||
|
||||
SELECT 'Updating Decimation' AS '';
|
||||
DROP INDEX _parent_oid_2 ON Decimation;
|
||||
ALTER TABLE Decimation ADD CONSTRAINT composite_index UNIQUE(_parent_oid,sampleRateNumerator,sampleRateDenominator);
|
||||
|
||||
SELECT 'Updating EventDescription' AS '';
|
||||
DROP INDEX _parent_oid_2 ON EventDescription;
|
||||
ALTER TABLE EventDescription ADD CONSTRAINT composite_index UNIQUE(_parent_oid,type);
|
||||
|
||||
SELECT 'Updating FocalMechanismReference' AS '';
|
||||
DROP INDEX _parent_oid_2 ON FocalMechanismReference;
|
||||
ALTER TABLE FocalMechanismReference ADD CONSTRAINT composite_index UNIQUE(_parent_oid,focalMechanismID);
|
||||
|
||||
SELECT 'Updating MomentTensorComponentContribution' AS '';
|
||||
DROP INDEX _parent_oid_2 ON MomentTensorComponentContribution;
|
||||
ALTER TABLE MomentTensorComponentContribution ADD CONSTRAINT composite_index UNIQUE(_parent_oid,phaseCode,component);
|
||||
|
||||
SELECT 'Updating MomentTensorPhaseSetting' AS '';
|
||||
DROP INDEX _parent_oid_2 ON MomentTensorPhaseSetting;
|
||||
ALTER TABLE MomentTensorPhaseSetting ADD CONSTRAINT composite_index UNIQUE(_parent_oid,code);
|
||||
|
||||
SELECT 'Updating OriginReference' AS '';
|
||||
DROP INDEX _parent_oid_2 ON OriginReference;
|
||||
ALTER TABLE OriginReference ADD CONSTRAINT composite_index UNIQUE(_parent_oid,originID);
|
||||
|
||||
SELECT 'Updating Outage' AS '';
|
||||
DROP INDEX _parent_oid_2 ON Outage;
|
||||
ALTER TABLE Outage ADD CONSTRAINT composite_index UNIQUE(_parent_oid,waveformID_networkCode,waveformID_stationCode,waveformID_locationCode,waveformID_channelCode,waveformID_resourceURI,start,start_ms);
|
||||
|
||||
SELECT 'Updating PickReference' AS '';
|
||||
DROP INDEX _parent_oid_2 ON PickReference;
|
||||
ALTER TABLE PickReference ADD CONSTRAINT composite_index UNIQUE(_parent_oid,pickID);
|
||||
|
||||
SELECT 'Updating QCLog' AS '';
|
||||
DROP INDEX _parent_oid_2 ON QCLog;
|
||||
ALTER TABLE QCLog ADD CONSTRAINT composite_index UNIQUE(_parent_oid,start,start_ms,waveformID_networkCode,waveformID_stationCode,waveformID_locationCode,waveformID_channelCode,waveformID_resourceURI);
|
||||
|
||||
SELECT 'Updating Route' AS '';
|
||||
DROP INDEX _parent_oid_2 ON Route;
|
||||
ALTER TABLE Route ADD CONSTRAINT composite_index UNIQUE(_parent_oid,networkCode,stationCode,locationCode,streamCode);
|
||||
|
||||
SELECT 'Updating RouteArclink' AS '';
|
||||
DROP INDEX _parent_oid_2 ON RouteArclink;
|
||||
ALTER TABLE RouteArclink ADD CONSTRAINT composite_index UNIQUE(_parent_oid,address,start);
|
||||
|
||||
SELECT 'Updating RouteSeedlink' AS '';
|
||||
DROP INDEX _parent_oid_2 ON RouteSeedlink;
|
||||
ALTER TABLE RouteSeedlink ADD CONSTRAINT composite_index UNIQUE(_parent_oid,address);
|
||||
|
||||
SELECT 'Updating Setup' AS '';
|
||||
DROP INDEX _parent_oid_2 ON Setup;
|
||||
ALTER TABLE Setup ADD CONSTRAINT composite_index UNIQUE(_parent_oid,name);
|
||||
|
||||
SELECT 'Updating StationMagnitudeContribution' AS '';
|
||||
DROP INDEX _parent_oid_2 ON StationMagnitudeContribution;
|
||||
ALTER TABLE StationMagnitudeContribution ADD CONSTRAINT composite_index UNIQUE(_parent_oid,stationMagnitudeID);
|
||||
|
||||
SELECT 'Updating StationReference' AS '';
|
||||
DROP INDEX _parent_oid_2 ON StationReference;
|
||||
ALTER TABLE StationReference ADD CONSTRAINT composite_index UNIQUE(_parent_oid,stationID);
|
||||
|
||||
SELECT 'Updating WaveformQuality' AS '';
|
||||
DROP INDEX _parent_oid_2 ON WaveformQuality;
|
||||
ALTER TABLE WaveformQuality ADD CONSTRAINT composite_index UNIQUE(_parent_oid,start,start_ms,waveformID_networkCode,waveformID_stationCode,waveformID_locationCode,waveformID_channelCode,waveformID_resourceURI,type,parameter);
|
||||
|
||||
# Convert Stream type to type that inherits from PublicObject
|
||||
SELECT 'Updating PublicObject' AS '';
|
||||
INSERT INTO PublicObject(_oid, publicID) SELECT _oid, concat("Stream/", DATE_FORMAT(_last_modified, '%Y%m%d%H%i%s'), ".", _oid) FROM Stream;
|
||||
|
||||
SELECT 'Updating Meta' AS '';
|
||||
UPDATE Meta SET value='0.10' WHERE name='Schema-Version';
|
104
share/db/migrations/postgresql/0_10_to_0_11.sql
Normal file
104
share/db/migrations/postgresql/0_10_to_0_11.sql
Normal file
@ -0,0 +1,104 @@
|
||||
\echo Add StationMagnitude.passedQC
|
||||
ALTER TABLE StationMagnitude ADD m_passedQC BOOLEAN;
|
||||
|
||||
\echo Creating DataAvailability PublicObject entry
|
||||
INSERT INTO Object(_oid) VALUES (DEFAULT);
|
||||
INSERT INTO PublicObject(_oid,m_publicID) VALUES (CURRVAL('Object_seq'),'DataAvailability');
|
||||
|
||||
|
||||
\echo Creating DataSegment
|
||||
CREATE TABLE DataSegment (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_start TIMESTAMP NOT NULL,
|
||||
m_start_ms INTEGER NOT NULL,
|
||||
m_end TIMESTAMP NOT NULL,
|
||||
m_end_ms INTEGER NOT NULL,
|
||||
m_updated TIMESTAMP NOT NULL,
|
||||
m_updated_ms INTEGER NOT NULL,
|
||||
m_sampleRate DOUBLE PRECISION NOT NULL,
|
||||
m_quality VARCHAR(8) NOT NULL,
|
||||
m_outOfOrder BOOLEAN NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT datasegment_composite_index UNIQUE(_parent_oid,m_start,m_start_ms)
|
||||
);
|
||||
|
||||
CREATE INDEX DataSegment__parent_oid ON DataSegment(_parent_oid);
|
||||
CREATE INDEX DataSegment_m_start_m_start_ms ON DataSegment(m_start,m_start_ms);
|
||||
CREATE INDEX DataSegment_m_end_m_end_ms ON DataSegment(m_end,m_end_ms);
|
||||
CREATE INDEX DataSegment_m_updated_m_updated_ms ON DataSegment(m_updated,m_updated_ms);
|
||||
|
||||
CREATE TRIGGER DataSegment_update BEFORE UPDATE ON DataSegment FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
\echo Creating DataAttributeExtent
|
||||
CREATE TABLE DataAttributeExtent (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_start TIMESTAMP NOT NULL,
|
||||
m_start_ms INTEGER NOT NULL,
|
||||
m_end TIMESTAMP NOT NULL,
|
||||
m_end_ms INTEGER NOT NULL,
|
||||
m_sampleRate DOUBLE PRECISION NOT NULL,
|
||||
m_quality VARCHAR(8) NOT NULL,
|
||||
m_updated TIMESTAMP NOT NULL,
|
||||
m_updated_ms INTEGER NOT NULL,
|
||||
m_segmentCount INT NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT dataattributeextent_composite_index UNIQUE(_parent_oid,m_sampleRate,m_quality)
|
||||
);
|
||||
|
||||
CREATE INDEX DataAttributeExtent__parent_oid ON DataAttributeExtent(_parent_oid);
|
||||
CREATE INDEX DataAttributeExtent_m_start_m_start_ms ON DataAttributeExtent(m_start,m_start_ms);
|
||||
CREATE INDEX DataAttributeExtent_m_end_m_end_ms ON DataAttributeExtent(m_end,m_end_ms);
|
||||
CREATE INDEX DataAttributeExtent_m_updated_m_updated_ms ON DataAttributeExtent(m_updated,m_updated_ms);
|
||||
|
||||
CREATE TRIGGER DataAttributeExtent_update BEFORE UPDATE ON DataAttributeExtent FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
\echo Creating DataExtent
|
||||
CREATE TABLE DataExtent (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_waveformID_networkCode VARCHAR(8) NOT NULL,
|
||||
m_waveformID_stationCode VARCHAR(8) NOT NULL,
|
||||
m_waveformID_locationCode VARCHAR(8),
|
||||
m_waveformID_channelCode VARCHAR(8),
|
||||
m_waveformID_resourceURI VARCHAR(255),
|
||||
m_start TIMESTAMP NOT NULL,
|
||||
m_start_ms INTEGER NOT NULL,
|
||||
m_end TIMESTAMP NOT NULL,
|
||||
m_end_ms INTEGER NOT NULL,
|
||||
m_updated TIMESTAMP NOT NULL,
|
||||
m_updated_ms INTEGER NOT NULL,
|
||||
m_lastScan TIMESTAMP NOT NULL,
|
||||
m_lastScan_ms INTEGER NOT NULL,
|
||||
m_segmentOverflow BOOLEAN NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT dataextent_composite_index UNIQUE(_parent_oid,m_waveformID_networkCode,m_waveformID_stationCode,m_waveformID_locationCode,m_waveformID_channelCode,m_waveformID_resourceURI)
|
||||
);
|
||||
|
||||
CREATE INDEX DataExtent__parent_oid ON DataExtent(_parent_oid);
|
||||
CREATE INDEX DataExtent_m_waveformID_resourceURI ON DataExtent(m_waveformID_resourceURI);
|
||||
CREATE INDEX DataExtent_m_start_m_start_ms ON DataExtent(m_start,m_start_ms);
|
||||
CREATE INDEX DataExtent_m_end_m_end_ms ON DataExtent(m_end,m_end_ms);
|
||||
CREATE INDEX DataExtent_m_updated_m_updated_ms ON DataExtent(m_updated,m_updated_ms);
|
||||
CREATE INDEX DataExtent_m_lastScan_m_lastScan_ms ON DataExtent(m_lastScan,m_lastScan_ms);
|
||||
|
||||
CREATE TRIGGER DataExtent_update BEFORE UPDATE ON DataExtent FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
\echo Updating Meta
|
||||
UPDATE Meta SET value='0.11' WHERE name='Schema-Version';
|
5
share/db/migrations/postgresql/0_11_to_0_12.sql
Normal file
5
share/db/migrations/postgresql/0_11_to_0_12.sql
Normal file
@ -0,0 +1,5 @@
|
||||
\echo Add Origin.m_uncertainty_confidenceLevel
|
||||
ALTER TABLE Origin ADD m_uncertainty_confidenceLevel DOUBLE PRECISION;
|
||||
|
||||
\echo Updating Meta
|
||||
UPDATE Meta SET value='0.12' WHERE name='Schema-Version';
|
2
share/db/migrations/postgresql/0_12_1_to_0_13.sql
Normal file
2
share/db/migrations/postgresql/0_12_1_to_0_13.sql
Normal file
@ -0,0 +1,2 @@
|
||||
\echo Updating Meta
|
||||
UPDATE Meta SET value='0.13' WHERE name='Schema-Version';
|
5
share/db/migrations/postgresql/0_12_to_0_12_1.sql
Normal file
5
share/db/migrations/postgresql/0_12_to_0_12_1.sql
Normal file
@ -0,0 +1,5 @@
|
||||
\echo Convert JournalEntry.m_parameters to BYTEA
|
||||
ALTER TABLE JournalEntry ALTER COLUMN m_parameters TYPE bytea USING m_parameters::bytea;
|
||||
|
||||
\echo Updating Meta
|
||||
UPDATE Meta SET value='0.12.1' WHERE name='Schema-Version';
|
8
share/db/migrations/postgresql/0_13_to_0_13_2.sql
Normal file
8
share/db/migrations/postgresql/0_13_to_0_13_2.sql
Normal file
@ -0,0 +1,8 @@
|
||||
\echo Convert Comment.m_text to TEXT
|
||||
ALTER TABLE Comment ALTER COLUMN m_text TYPE TEXT;
|
||||
|
||||
\echo Convert JournalEntry.m_parameters to TEXT
|
||||
ALTER TABLE JournalEntry ALTER COLUMN m_parameters TYPE TEXT;
|
||||
|
||||
\echo Updating Meta
|
||||
UPDATE Meta SET value='0.13.2' WHERE name='Schema-Version';
|
20
share/db/migrations/postgresql/0_7_to_0_8.sql
Normal file
20
share/db/migrations/postgresql/0_7_to_0_8.sql
Normal file
@ -0,0 +1,20 @@
|
||||
CREATE TABLE ResponseFAP (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_name VARCHAR(255),
|
||||
m_gain DOUBLE PRECISION,
|
||||
m_gainFrequency DOUBLE PRECISION,
|
||||
m_numberOfTuples SMALLINT,
|
||||
m_tuples_content BYTEA,
|
||||
m_tuples_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_remark_content BYTEA,
|
||||
m_remark_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE(_parent_oid,m_name)
|
||||
);
|
||||
|
||||
UPDATE Meta SET value='0.8' WHERE name='Schema-Version';
|
12
share/db/migrations/postgresql/0_8_to_0_9.sql
Normal file
12
share/db/migrations/postgresql/0_8_to_0_9.sql
Normal file
@ -0,0 +1,12 @@
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_agencyID VARCHAR(64);
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_agencyURI VARCHAR(255);
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_author VARCHAR(128);
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_authorURI VARCHAR(255);
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_creationTime TIMESTAMP;
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_creationTime_ms INTEGER;
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_modificationTime TIMESTAMP;
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_modificationTime_ms INTEGER;
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_version VARCHAR(64);
|
||||
ALTER TABLE ConfigStation ADD m_creationInfo_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
UPDATE Meta SET value='0.9' WHERE name='Schema-Version';
|
392
share/db/migrations/postgresql/0_9_to_0_10.sql
Normal file
392
share/db/migrations/postgresql/0_9_to_0_10.sql
Normal file
@ -0,0 +1,392 @@
|
||||
\echo Creating ResponseIIR
|
||||
CREATE TABLE ResponseIIR (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_name VARCHAR(255),
|
||||
m_type VARCHAR(1),
|
||||
m_gain DOUBLE PRECISION,
|
||||
m_gainFrequency DOUBLE PRECISION,
|
||||
m_decimationFactor SMALLINT,
|
||||
m_delay DOUBLE PRECISION,
|
||||
m_correction DOUBLE PRECISION,
|
||||
m_numberOfNumerators SMALLINT,
|
||||
m_numberOfDenominators SMALLINT,
|
||||
m_numerators_content BYTEA,
|
||||
m_numerators_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_denominators_content BYTEA,
|
||||
m_denominators_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_remark_content BYTEA,
|
||||
m_remark_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT responseiir_composite_index UNIQUE(_parent_oid,m_name)
|
||||
);
|
||||
|
||||
CREATE INDEX ResponseIIR__parent_oid ON ResponseIIR(_parent_oid);
|
||||
CREATE TRIGGER ResponseIIR_update BEFORE UPDATE ON ResponseIIR FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
\echo Updating Comment
|
||||
ALTER TABLE Comment
|
||||
ADD m_start TIMESTAMP,
|
||||
ADD m_start_ms INTEGER,
|
||||
ADD m_end TIMESTAMP,
|
||||
ADD m_end_ms INTEGER;
|
||||
ALTER TABLE ONLY Comment ADD CONSTRAINT comment_composite_index UNIQUE (_parent_oid, m_id);
|
||||
ALTER TABLE ONLY Comment DROP CONSTRAINT comment__parent_oid_m_id_key;
|
||||
|
||||
\echo Updating AuxStream
|
||||
ALTER TABLE AuxStream
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER,
|
||||
ALTER m_format TYPE VARCHAR(50);
|
||||
ALTER TABLE AuxStream ALTER m_start_ms DROP DEFAULT;
|
||||
UPDATE AuxStream SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY AuxStream ADD CONSTRAINT auxstream_composite_index UNIQUE(_parent_oid,m_code,m_start,m_start_ms);
|
||||
ALTER TABLE ONLY AuxStream DROP CONSTRAINT auxstream__parent_oid_m_code_m_start_key;
|
||||
|
||||
\echo Updating Stream
|
||||
ALTER TABLE Stream
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER,
|
||||
ALTER m_format TYPE VARCHAR(50);
|
||||
ALTER TABLE Stream ALTER m_start_ms DROP DEFAULT;
|
||||
UPDATE Stream SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY Stream ADD CONSTRAINT stream_composite_index UNIQUE(_parent_oid,m_code,m_start,m_start_ms);
|
||||
ALTER TABLE ONLY Stream DROP CONSTRAINT stream__parent_oid_m_code_m_start_key;
|
||||
|
||||
\echo Updating SensorLocation
|
||||
ALTER TABLE SensorLocation
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER;
|
||||
ALTER TABLE SensorLocation ALTER m_start_ms DROP DEFAULT;
|
||||
UPDATE SensorLocation SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY SensorLocation ADD CONSTRAINT sensorlocation_composite_index UNIQUE(_parent_oid,m_code,m_start,m_start_ms);
|
||||
ALTER TABLE ONLY SensorLocation DROP CONSTRAINT sensorlocation__parent_oid_m_code_m_start_key;
|
||||
|
||||
\echo Updating Station
|
||||
ALTER TABLE Station
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER,
|
||||
ALTER m_description TYPE VARCHAR(255);
|
||||
ALTER TABLE Station ALTER m_start_ms DROP DEFAULT;
|
||||
ALTER TABLE ONLY Station ADD CONSTRAINT station_composite_index UNIQUE (_parent_oid, m_code, m_start, m_start_ms);
|
||||
ALTER TABLE ONLY Station DROP CONSTRAINT station__parent_oid_m_code_m_start_key;
|
||||
|
||||
\echo Updating DataloggerCalibration
|
||||
ALTER TABLE DataloggerCalibration
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER;
|
||||
ALTER TABLE DataloggerCalibration ALTER m_start_ms DROP DEFAULT;
|
||||
UPDATE DataloggerCalibration SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY DataloggerCalibration ADD CONSTRAINT dataloggercalibration_composite_index UNIQUE(_parent_oid,m_serialNumber,m_channel,m_start,m_start_ms);
|
||||
ALTER TABLE ONLY DataloggerCalibration DROP CONSTRAINT dataloggercalibration__parent_oid_m_serialnumber_m_channel__key;
|
||||
|
||||
\echo Updating SensorCalibration
|
||||
ALTER TABLE SensorCalibration
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER;
|
||||
ALTER TABLE SensorCalibration ALTER m_start_ms DROP DEFAULT;
|
||||
UPDATE SensorCalibration SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY SensorCalibration ADD CONSTRAINT sensorcalibration_composite_index UNIQUE(_parent_oid,m_serialNumber,m_channel,m_start,m_start_ms);
|
||||
ALTER TABLE ONLY SensorCalibration DROP CONSTRAINT sensorcalibration__parent_oid_m_serialnumber_m_channel_m_st_key;
|
||||
|
||||
\echo Updating Network
|
||||
ALTER TABLE Network
|
||||
ADD m_start_ms INTEGER NOT NULL DEFAULT '0',
|
||||
ADD m_end_ms INTEGER,
|
||||
ALTER m_description TYPE VARCHAR(255);
|
||||
ALTER TABLE Network ALTER m_start_ms DROP DEFAULT;
|
||||
UPDATE Network SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY Network ADD CONSTRAINT network_composite_index UNIQUE(_parent_oid,m_code,m_start,m_start_ms);
|
||||
ALTER TABLE ONLY Network DROP CONSTRAINT network__parent_oid_m_code_m_start_key;
|
||||
|
||||
\echo Updating ResponseFIR
|
||||
ALTER TABLE ResponseFIR ADD m_gainFrequency DOUBLE PRECISION;
|
||||
ALTER TABLE ONLY ResponseFIR ADD CONSTRAINT responsefir_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY ResponseFIR DROP CONSTRAINT responsefir__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating ResponsePAZ
|
||||
ALTER TABLE ResponsePAZ
|
||||
ADD m_decimationFactor SMALLINT,
|
||||
ADD m_delay DOUBLE PRECISION,
|
||||
ADD m_correction DOUBLE PRECISION;
|
||||
ALTER TABLE ONLY ResponsePAZ ADD CONSTRAINT responsepaz_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY ResponsePAZ DROP CONSTRAINT responsepaz__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating StationGroup
|
||||
ALTER TABLE StationGroup
|
||||
ADD m_start_ms INTEGER,
|
||||
ADD m_end_ms INTEGER,
|
||||
ALTER m_code TYPE VARCHAR(20),
|
||||
ALTER m_description TYPE VARCHAR(255);
|
||||
UPDATE StationGroup SET m_start_ms=0 WHERE m_start != NULL;
|
||||
UPDATE StationGroup SET m_end_ms=0 WHERE m_end != NULL;
|
||||
ALTER TABLE ONLY StationGroup ADD CONSTRAINT stationgroup_composite_index UNIQUE (_parent_oid, m_code);
|
||||
ALTER TABLE ONLY StationGroup DROP CONSTRAINT stationgroup__parent_oid_m_code_key;
|
||||
|
||||
\echo Updating AuxSource
|
||||
ALTER TABLE AuxSource
|
||||
ALTER m_name TYPE VARCHAR(255),
|
||||
ALTER m_description TYPE VARCHAR(255);
|
||||
ALTER TABLE ONLY AuxSource ADD CONSTRAINT auxsource_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY AuxSource DROP CONSTRAINT auxsource__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating AuxDevice
|
||||
ALTER TABLE AuxDevice
|
||||
ALTER m_name TYPE VARCHAR(255),
|
||||
ALTER m_description TYPE VARCHAR(255);
|
||||
ALTER TABLE ONLY AuxDevice ADD CONSTRAINT auxdevice_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY AuxDevice DROP CONSTRAINT auxdevice__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating Sensor
|
||||
ALTER TABLE Sensor ALTER m_name TYPE VARCHAR(255);
|
||||
ALTER TABLE ONLY Sensor ADD CONSTRAINT sensor_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY Sensor DROP CONSTRAINT sensor__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating Datalogger
|
||||
ALTER TABLE Datalogger ALTER m_description TYPE VARCHAR(255);
|
||||
ALTER TABLE ONLY Datalogger ADD CONSTRAINT datalogger_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY Datalogger DROP CONSTRAINT datalogger__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating CompositeTime
|
||||
ALTER TABLE CompositeTime
|
||||
ADD m_second_pdf_variable_content BYTEA,
|
||||
ADD m_second_pdf_probability_content BYTEA,
|
||||
ADD m_second_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating MomentTensor
|
||||
ALTER TABLE MomentTensor
|
||||
ADD m_scalarMoment_pdf_variable_content BYTEA,
|
||||
ADD m_scalarMoment_pdf_probability_content BYTEA,
|
||||
ADD m_scalarMoment_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_tensor_Mrr_pdf_variable_content BYTEA,
|
||||
ADD m_tensor_Mrr_pdf_probability_content BYTEA,
|
||||
ADD m_tensor_Mrr_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_tensor_Mtt_pdf_variable_content BYTEA,
|
||||
ADD m_tensor_Mtt_pdf_probability_content BYTEA,
|
||||
ADD m_tensor_Mtt_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_tensor_Mpp_pdf_variable_content BYTEA,
|
||||
ADD m_tensor_Mpp_pdf_probability_content BYTEA,
|
||||
ADD m_tensor_Mpp_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_tensor_Mrt_pdf_variable_content BYTEA,
|
||||
ADD m_tensor_Mrt_pdf_probability_content BYTEA,
|
||||
ADD m_tensor_Mrt_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_tensor_Mrp_pdf_variable_content BYTEA,
|
||||
ADD m_tensor_Mrp_pdf_probability_content BYTEA,
|
||||
ADD m_tensor_Mrp_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_tensor_Mtp_pdf_variable_content BYTEA,
|
||||
ADD m_tensor_Mtp_pdf_probability_content BYTEA,
|
||||
ADD m_tensor_Mtp_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating FocalMechanism
|
||||
ALTER TABLE FocalMechanism
|
||||
ADD m_nodalPlanes_nodalPlane1_strike_pdf_variable_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane1_strike_pdf_probability_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane1_strike_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_nodalPlanes_nodalPlane1_dip_pdf_variable_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane1_dip_pdf_probability_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane1_dip_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_nodalPlanes_nodalPlane1_rake_pdf_variable_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane1_rake_pdf_probability_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane1_rake_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_nodalPlanes_nodalPlane2_strike_pdf_variable_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane2_strike_pdf_probability_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane2_strike_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_nodalPlanes_nodalPlane2_dip_pdf_variable_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane2_dip_pdf_probability_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane2_dip_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_nodalPlanes_nodalPlane2_rake_pdf_variable_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane2_rake_pdf_probability_content BYTEA,
|
||||
ADD m_nodalPlanes_nodalPlane2_rake_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_tAxis_azimuth_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_tAxis_azimuth_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_tAxis_azimuth_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_tAxis_plunge_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_tAxis_plunge_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_tAxis_plunge_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_tAxis_length_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_tAxis_length_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_tAxis_length_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_pAxis_azimuth_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_pAxis_azimuth_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_pAxis_azimuth_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_pAxis_plunge_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_pAxis_plunge_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_pAxis_plunge_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_pAxis_length_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_pAxis_length_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_pAxis_length_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_nAxis_azimuth_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_nAxis_azimuth_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_nAxis_azimuth_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_nAxis_plunge_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_nAxis_plunge_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_nAxis_plunge_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_principalAxes_nAxis_length_pdf_variable_content BYTEA,
|
||||
ADD m_principalAxes_nAxis_length_pdf_probability_content BYTEA,
|
||||
ADD m_principalAxes_nAxis_length_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating Amplitude
|
||||
ALTER TABLE Amplitude
|
||||
ADD m_amplitude_pdf_variable_content BYTEA,
|
||||
ADD m_amplitude_pdf_probability_content BYTEA,
|
||||
ADD m_amplitude_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_period_pdf_variable_content BYTEA,
|
||||
ADD m_period_pdf_probability_content BYTEA,
|
||||
ADD m_period_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_scalingTime_pdf_variable_content BYTEA,
|
||||
ADD m_scalingTime_pdf_probability_content BYTEA,
|
||||
ADD m_scalingTime_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating Magnitude
|
||||
ALTER TABLE Magnitude
|
||||
ADD m_magnitude_pdf_variable_content BYTEA,
|
||||
ADD m_magnitude_pdf_probability_content BYTEA,
|
||||
ADD m_magnitude_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating StationMagnitude
|
||||
ALTER TABLE StationMagnitude
|
||||
ADD m_magnitude_pdf_variable_content BYTEA,
|
||||
ADD m_magnitude_pdf_probability_content BYTEA,
|
||||
ADD m_magnitude_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating Pick
|
||||
ALTER TABLE Pick
|
||||
ADD m_time_pdf_variable_content BYTEA,
|
||||
ADD m_time_pdf_probability_content BYTEA,
|
||||
ADD m_time_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_horizontalSlowness_pdf_variable_content BYTEA,
|
||||
ADD m_horizontalSlowness_pdf_probability_content BYTEA,
|
||||
ADD m_horizontalSlowness_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_backazimuth_pdf_variable_content BYTEA,
|
||||
ADD m_backazimuth_pdf_probability_content BYTEA,
|
||||
ADD m_backazimuth_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating Origin
|
||||
ALTER TABLE Origin
|
||||
ADD m_time_pdf_variable_content BYTEA,
|
||||
ADD m_time_pdf_probability_content BYTEA,
|
||||
ADD m_time_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_latitude_pdf_variable_content BYTEA,
|
||||
ADD m_latitude_pdf_probability_content BYTEA,
|
||||
ADD m_latitude_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_longitude_pdf_variable_content BYTEA,
|
||||
ADD m_longitude_pdf_probability_content BYTEA,
|
||||
ADD m_longitude_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
ADD m_depth_pdf_variable_content BYTEA,
|
||||
ADD m_depth_pdf_probability_content BYTEA,
|
||||
ADD m_depth_pdf_used BOOLEAN NOT NULL DEFAULT '0';
|
||||
|
||||
\echo Updating Access
|
||||
ALTER TABLE ONLY Access ADD CONSTRAINT access_composite_index UNIQUE (_parent_oid, m_networkcode, m_stationcode, m_locationcode, m_streamcode, m_user, m_start);
|
||||
ALTER TABLE ONLY Access DROP CONSTRAINT access__parent_oid_m_networkcode_m_stationcode_m_locationco_key;
|
||||
|
||||
\echo Updating AmplitudeReference
|
||||
ALTER TABLE ONLY AmplitudeReference ADD CONSTRAINT amplitudereference_composite_index UNIQUE (_parent_oid, m_amplitudeid);
|
||||
ALTER TABLE ONLY AmplitudeReference DROP CONSTRAINT amplitudereference__parent_oid_m_amplitudeid_key;
|
||||
|
||||
\echo Updating ArclinkRequest
|
||||
ALTER TABLE ONLY ArclinkRequest ADD CONSTRAINT arclinkrequest_composite_index UNIQUE (_parent_oid, m_created, m_created_ms, m_requestid, m_userid);
|
||||
ALTER TABLE ONLY ArclinkRequest DROP CONSTRAINT arclinkrequest__parent_oid_m_created_m_created_ms_m_request_key;
|
||||
|
||||
\echo Updating ArclinkRequestLine
|
||||
ALTER TABLE ONLY ArclinkRequestLine ADD CONSTRAINT arclinkrequestline_composite_index UNIQUE (_parent_oid, m_start, m_start_ms, m_end, m_end_ms, m_streamid_networkcode, m_streamid_stationcode, m_streamid_locationcode, m_streamid_channelcode, m_streamid_resourceuri);
|
||||
ALTER TABLE ONLY ArclinkRequestLine DROP CONSTRAINT arclinkrequestline__parent_oid_m_start_m_start_ms_m_end_m_e_key;
|
||||
|
||||
\echo Updating ArclinkStatusLine
|
||||
ALTER TABLE ONLY ArclinkStatusLine ADD CONSTRAINT arclinkstatusline_composite_index UNIQUE (_parent_oid, m_volumeid, m_type, m_status);
|
||||
ALTER TABLE ONLY ArclinkStatusLine DROP CONSTRAINT arclinkstatusline__parent_oid_m_volumeid_m_type_m_status_key;
|
||||
|
||||
\echo Updating ArclinkUser
|
||||
ALTER TABLE ONLY ArclinkUser ADD CONSTRAINT arclinkuser_composite_index UNIQUE (_parent_oid, m_name, m_email);
|
||||
ALTER TABLE ONLY ArclinkUser DROP CONSTRAINT arclinkuser__parent_oid_m_name_m_email_key;
|
||||
|
||||
\echo Updating Arrival
|
||||
ALTER TABLE ONLY Arrival ADD CONSTRAINT arrival_composite_index UNIQUE (_parent_oid, m_pickid);
|
||||
ALTER TABLE ONLY Arrival DROP CONSTRAINT arrival__parent_oid_m_pickid_key;
|
||||
|
||||
\echo Updating ConfigStation
|
||||
ALTER TABLE ONLY ConfigStation ADD CONSTRAINT configstation_composite_index UNIQUE (_parent_oid, m_networkcode, m_stationcode);
|
||||
ALTER TABLE ONLY ConfigStation DROP CONSTRAINT configstation__parent_oid_m_networkcode_m_stationcode_key;
|
||||
|
||||
\echo Updating Decimation
|
||||
ALTER TABLE ONLY Decimation ADD CONSTRAINT decimation_composite_index UNIQUE (_parent_oid, m_sampleratenumerator, m_sampleratedenominator);
|
||||
ALTER TABLE ONLY Decimation DROP CONSTRAINT decimation__parent_oid_m_sampleratenumerator_m_sampleratede_key;
|
||||
|
||||
\echo Updating EventDescription
|
||||
ALTER TABLE ONLY EventDescription ADD CONSTRAINT eventdescription_composite_index UNIQUE (_parent_oid, m_type);
|
||||
ALTER TABLE ONLY EventDescription DROP CONSTRAINT eventdescription__parent_oid_m_type_key;
|
||||
|
||||
\echo Updating FocalMechanismReference
|
||||
ALTER TABLE ONLY FocalMechanismReference ADD CONSTRAINT focalmechanismreference_composite_index UNIQUE (_parent_oid, m_focalmechanismid);
|
||||
ALTER TABLE ONLY FocalMechanismReference DROP CONSTRAINT focalmechanismreference__parent_oid_m_focalmechanismid_key;
|
||||
|
||||
\echo Updating MomentTensorComponentContribution
|
||||
ALTER TABLE ONLY MomentTensorComponentContribution ADD CONSTRAINT momenttensorcomponentcontribution_composite_index UNIQUE (_parent_oid, m_phasecode, m_component);
|
||||
ALTER TABLE ONLY MomentTensorComponentContribution DROP CONSTRAINT momenttensorcomponentcontribu__parent_oid_m_phasecode_m_com_key;
|
||||
|
||||
\echo Updating MomentTensorPhaseSetting
|
||||
ALTER TABLE ONLY MomentTensorPhaseSetting ADD CONSTRAINT momenttensorphasesetting_composite_index UNIQUE (_parent_oid, m_code);
|
||||
ALTER TABLE ONLY MomentTensorPhaseSetting DROP CONSTRAINT momenttensorphasesetting__parent_oid_m_code_key;
|
||||
|
||||
\echo Updating OriginReference
|
||||
ALTER TABLE ONLY OriginReference ADD CONSTRAINT originreference_composite_index UNIQUE (_parent_oid, m_originid);
|
||||
ALTER TABLE ONLY OriginReference DROP CONSTRAINT originreference__parent_oid_m_originid_key;
|
||||
|
||||
\echo Updating Outage
|
||||
ALTER TABLE ONLY Outage ADD CONSTRAINT outage_composite_index UNIQUE (_parent_oid, m_waveformid_networkcode, m_waveformid_stationcode, m_waveformid_locationcode, m_waveformid_channelcode, m_waveformid_resourceuri, m_start, m_start_ms);
|
||||
ALTER TABLE ONLY Outage DROP CONSTRAINT outage__parent_oid_m_waveformid_networkcode_m_waveformid_st_key;
|
||||
|
||||
\echo Updating PickReference
|
||||
ALTER TABLE ONLY PickReference ADD CONSTRAINT pickreference_composite_index UNIQUE (_parent_oid, m_pickid);
|
||||
ALTER TABLE ONLY PickReference DROP CONSTRAINT pickreference__parent_oid_m_pickid_key;
|
||||
|
||||
\echo Updating QCLog
|
||||
ALTER TABLE ONLY QCLog ADD CONSTRAINT qclog_composite_index UNIQUE (_parent_oid, m_start, m_start_ms, m_waveformid_networkcode, m_waveformid_stationcode, m_waveformid_locationcode, m_waveformid_channelcode, m_waveformid_resourceuri);
|
||||
ALTER TABLE ONLY QCLog DROP CONSTRAINT qclog__parent_oid_m_start_m_start_ms_m_waveformid_networkco_key;
|
||||
|
||||
\echo Updating ResponseFAP
|
||||
ALTER TABLE ONLY ResponseFAP ADD CONSTRAINT responsefap_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY ResponseFAP DROP CONSTRAINT responsefap__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating ResponsePolynomial
|
||||
ALTER TABLE ONLY ResponsePolynomial ADD CONSTRAINT responsepolynomial_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY ResponsePolynomial DROP CONSTRAINT responsepolynomial__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating Route
|
||||
ALTER TABLE ONLY Route ADD CONSTRAINT route_composite_index UNIQUE (_parent_oid, m_networkcode, m_stationcode, m_locationcode, m_streamcode);
|
||||
ALTER TABLE ONLY Route DROP CONSTRAINT route__parent_oid_m_networkcode_m_stationcode_m_locationcod_key;
|
||||
|
||||
\echo Updating RouteArclink
|
||||
ALTER TABLE ONLY RouteArclink ADD CONSTRAINT routearclink_composite_index UNIQUE (_parent_oid, m_address, m_start);
|
||||
ALTER TABLE ONLY RouteArclink DROP CONSTRAINT routearclink__parent_oid_m_address_m_start_key;
|
||||
|
||||
\echo Updating RouteSeedlink
|
||||
ALTER TABLE ONLY RouteSeedlink ADD CONSTRAINT routeseedlink_composite_index UNIQUE (_parent_oid, m_address);
|
||||
ALTER TABLE ONLY RouteSeedlink DROP CONSTRAINT routeseedlink__parent_oid_m_address_key;
|
||||
|
||||
\echo Updating Setup
|
||||
ALTER TABLE ONLY Setup ADD CONSTRAINT setup_composite_index UNIQUE (_parent_oid, m_name);
|
||||
ALTER TABLE ONLY Setup DROP CONSTRAINT setup__parent_oid_m_name_key;
|
||||
|
||||
\echo Updating StationMagnitudeContribution
|
||||
ALTER TABLE ONLY StationMagnitudeContribution ADD CONSTRAINT stationmagnitudecontribution_composite_index UNIQUE (_parent_oid, m_stationmagnitudeid);
|
||||
ALTER TABLE ONLY StationMagnitudeContribution DROP CONSTRAINT stationmagnitudecontribution__parent_oid_m_stationmagnitude_key;
|
||||
|
||||
\echo Updating StationReference
|
||||
ALTER TABLE ONLY StationReference ADD CONSTRAINT stationreference_composite_index UNIQUE (_parent_oid, m_stationid);
|
||||
ALTER TABLE ONLY StationReference DROP CONSTRAINT stationreference__parent_oid_m_stationid_key;
|
||||
|
||||
\echo Updating WaveformQuality
|
||||
ALTER TABLE ONLY WaveformQuality ADD CONSTRAINT waveformquality_composite_index UNIQUE (_parent_oid, m_start, m_start_ms, m_waveformid_networkcode, m_waveformid_stationcode, m_waveformid_locationcode, m_waveformid_channelcode, m_waveformid_resourceuri, m_type, m_parameter);
|
||||
ALTER TABLE ONLY WaveformQuality DROP CONSTRAINT waveformquality__parent_oid_m_start_m_start_ms_m_waveformid_key;
|
||||
|
||||
/* Convert Stream type to type that inherits from PublicObject */
|
||||
\echo Updating PublicObject
|
||||
INSERT INTO PublicObject(_oid, m_publicID) SELECT _oid, 'Stream/' || to_char(_last_modified, 'YYYYmmddHHMISS') || '.' || _oid FROM Stream;
|
||||
|
||||
\echo Updating Meta
|
||||
UPDATE Meta SET value='0.10' WHERE name='Schema-Version';
|
1842
share/db/mysql.sql
Normal file
1842
share/db/mysql.sql
Normal file
File diff suppressed because it is too large
Load Diff
162
share/db/mysql_setup.py
Executable file
162
share/db/mysql_setup.py
Executable file
@ -0,0 +1,162 @@
|
||||
#!/usr/bin/env seiscomp-python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
############################################################################
|
||||
# Copyright (C) 2016 by gempa GmbH #
|
||||
# #
|
||||
# All Rights Reserved. #
|
||||
# #
|
||||
# NOTICE: All information contained herein is, and remains #
|
||||
# the property of gempa GmbH and its suppliers, if any. The intellectual #
|
||||
# and technical concepts contained herein are proprietary to gempa GmbH #
|
||||
# and its suppliers. #
|
||||
# Dissemination of this information or reproduction of this material #
|
||||
# is strictly forbidden unless prior written permission is obtained #
|
||||
# from gempa GmbH. #
|
||||
############################################################################
|
||||
|
||||
from __future__ import (
|
||||
absolute_import,
|
||||
print_function)
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from utils import write, execute
|
||||
|
||||
def createMYSQLDB(
|
||||
db,
|
||||
rwuser,
|
||||
rwpwd,
|
||||
rouser,
|
||||
ropwd,
|
||||
rwhost,
|
||||
rootpwd,
|
||||
drop,
|
||||
schemapath,
|
||||
characterset):
|
||||
cmd = "mysql -u root -h " + rwhost
|
||||
if rootpwd:
|
||||
cmd += " -p" + rootpwd
|
||||
|
||||
write("+ Create MYSQL database")
|
||||
|
||||
res = execute(cmd + " -s --skip-column-names -e \"select version()\"")
|
||||
if res.error:
|
||||
print(" \n"
|
||||
" Could not determine MYSQL server version. Is the root password correct\n"
|
||||
" and MYSQL is running and the client installed on "
|
||||
"this machine?",
|
||||
file=sys.stderr)
|
||||
return False
|
||||
|
||||
write(" + Found MYSQL server version {}".format(res.data))
|
||||
if drop:
|
||||
q = "DROP DATABASE IF EXISTS \\`{}\\`;".format(db)
|
||||
print(" + Drop database {}".format(db))
|
||||
res = execute(cmd + " -e \"{}\"".format(q))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
write(" + Create database {}".format(db))
|
||||
|
||||
q = "CREATE DATABASE \\`{}\\`".format(db)
|
||||
if characterset is not None:
|
||||
q += f" CHARACTER SET {characterset} COLLATE {characterset}_bin"
|
||||
q += ";"
|
||||
|
||||
res = execute(cmd + " -e \"{}\"".format(q))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
write(" + Setup user roles")
|
||||
|
||||
# MySQL 8 requires explicit "CREATE USER", but this fails
|
||||
# if the user already exists.
|
||||
# "CREATE USER IF NOT EXISTS" is not supported by MySQL<5.7.
|
||||
# Drop possibly existing users, ignoring errors.
|
||||
|
||||
res = execute(cmd + " -e \"SELECT 1 FROM mysql.user "
|
||||
"WHERE user = '{}'\"".format(rwuser))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
q = ""
|
||||
exists = "1" in res.data
|
||||
if not exists:
|
||||
q += "CREATE USER '{}'@'localhost' IDENTIFIED BY '{}';".format(rwuser, rwpwd)
|
||||
q += "CREATE USER '{}'@'%' IDENTIFIED BY '{}';".format(rwuser, rwpwd)
|
||||
|
||||
q += "GRANT ALL ON \\`{}\\`.* TO '{}'@'localhost';".format(db, rwuser)
|
||||
q += "GRANT ALL ON \\`{}\\`.* TO '{}'@'%';".format(db, rwuser)
|
||||
|
||||
res = execute(cmd + " -e \"{}\"".format(q))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
if rwuser != rouser:
|
||||
res = execute(cmd + " -e \"SELECT 1 FROM mysql.user "
|
||||
"WHERE user = '{}'\"".format(rouser))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
q = ""
|
||||
exists = "1" in res.data
|
||||
if not exists:
|
||||
q += "CREATE USER '{}'@'localhost' IDENTIFIED BY '{}';".format(rouser, ropwd)
|
||||
q += "CREATE USER '{}'@'%' IDENTIFIED BY '{}';".format(rouser, ropwd)
|
||||
|
||||
q += "GRANT SELECT ON \\`{}\\`.* TO '{}'@'localhost';".format(db, rouser)
|
||||
q += "GRANT SELECT ON \\`{}\\`.* TO '{}'@'%';".format(db, rouser)
|
||||
|
||||
res = execute(cmd + " -e \"{}\"".format(q))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
write(" + Create tables")
|
||||
q = "USE \\`{}\\`; source {};".format(db, os.path.join(schemapath, "mysql.sql"))
|
||||
res = execute(cmd + " -e \"{}\"".format(q))
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 10 or len(sys.argv) > 11:
|
||||
print("Usage: mysql_setup.py <db> <rwuser> <rwpwd> <rouser> <ropwd> "
|
||||
"<rwhost> <mysql rootpwd> <drop> <schema path> <characterset>\n\n"
|
||||
"For example: mysql_setup.py seiscomp sysop sysop sysop sysop "
|
||||
"localhost <password> false ~/seiscomp/share/db/")
|
||||
return 1
|
||||
|
||||
db = sys.argv[1]
|
||||
rwuser = sys.argv[2]
|
||||
rwpwd = sys.argv[3]
|
||||
rouser = sys.argv[4]
|
||||
ropwd = sys.argv[5]
|
||||
rwhost = sys.argv[6]
|
||||
rootpwd = sys.argv[7]
|
||||
schemapath = sys.argv[9]
|
||||
if len(sys.argv) > 10:
|
||||
characterset = sys.argv[10]
|
||||
else:
|
||||
characterset = "utf8mb4"
|
||||
|
||||
drop = sys.argv[8].lower() == 'true'
|
||||
|
||||
os.chdir(tempfile.gettempdir())
|
||||
if not createMYSQLDB(db, rwuser, rwpwd, rouser, ropwd, rwhost, rootpwd, drop, schemapath, characterset):
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
31
share/db/pkexec_wrapper.sh
Executable file
31
share/db/pkexec_wrapper.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
pid=-1
|
||||
|
||||
# the cleanup function will be the exit point
|
||||
cleanup () {
|
||||
if [ $pid -ne -1 ]
|
||||
then
|
||||
kill $pid &>/dev/null
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: pkexec_wrapper.sh <cmd>"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
trap cleanup EXIT ERR INT TERM
|
||||
|
||||
cmd=$1
|
||||
|
||||
# The fallback agent can only be started when the device /dev/tty
|
||||
# is available and usable. If this script is started from the
|
||||
# desktop the tty device may not be available.
|
||||
if !(test "$(ps -p "$$" -o tty=)" = "?"); then
|
||||
pkttyagent -p $(echo $$) --fallback &
|
||||
pid=`echo $!`
|
||||
fi
|
||||
|
||||
pkexec "$@"
|
2100
share/db/postgres.sql
Normal file
2100
share/db/postgres.sql
Normal file
File diff suppressed because it is too large
Load Diff
149
share/db/postgres_setup.py
Executable file
149
share/db/postgres_setup.py
Executable file
@ -0,0 +1,149 @@
|
||||
#!/usr/bin/env seiscomp-python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
############################################################################
|
||||
# Copyright (C) 2016 by gempa GmbH #
|
||||
# #
|
||||
# All Rights Reserved. #
|
||||
# #
|
||||
# NOTICE: All information contained herein is, and remains #
|
||||
# the property of gempa GmbH and its suppliers, if any. The intellectual #
|
||||
# and technical concepts contained herein are proprietary to gempa GmbH #
|
||||
# and its suppliers. #
|
||||
# Dissemination of this information or reproduction of this material #
|
||||
# is strictly forbidden unless prior written permission is obtained #
|
||||
# from gempa GmbH. #
|
||||
############################################################################
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from utils import write, execute
|
||||
|
||||
|
||||
def createPostgresSQLDB(
|
||||
db, rwuser, rwpwd, rouser, ropwd, rwhost, drop, schemapath
|
||||
):
|
||||
# cmd = "psql --host {}".format(rwhost)
|
||||
# We have to disable notice messages with --client-min-messages=warning
|
||||
# because PostgreSQL outputs notice messages to stderr when e.g. tables should
|
||||
# be removed which do not exist even the if exist check is inplace.
|
||||
cmd = "PGOPTIONS='--client-min-messages=warning' psql"
|
||||
|
||||
write("+ Create PostgresSQL database")
|
||||
|
||||
if drop:
|
||||
q = f"DROP DATABASE IF EXISTS {db};"
|
||||
write(f" + Drop database {db}")
|
||||
|
||||
res = execute(f'{cmd} -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
write(f" + Check user {rwuser}")
|
||||
q = f"SELECT 1 FROM pg_roles WHERE rolname='{rwuser}'"
|
||||
res = execute(cmd + f' -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
rwUserExits = "1" in res.data
|
||||
|
||||
if not rwUserExits:
|
||||
write(f" + Create user {rwuser}")
|
||||
q = f"CREATE USER {rwuser} WITH ENCRYPTED PASSWORD '{rwpwd}';"
|
||||
res = execute(f'{cmd} -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
write(f" + Create database {db}")
|
||||
|
||||
q = f"CREATE DATABASE {db} OWNER {rwuser} ENCODING 'UTF8'"
|
||||
res = execute(f'{cmd} -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
#q = f"ALTER DATABASE {db} SET bytea_output TO 'escape'"
|
||||
#res = execute(f'{cmd} -c "{q}"')
|
||||
#if res.error:
|
||||
# print(f" + {res.error}")
|
||||
# return False
|
||||
|
||||
write(" + Create SeisComP tables")
|
||||
|
||||
q = f"\\i {os.path.join(schemapath, 'postgres.sql')};"
|
||||
res = execute(f'PGPASSWORD={rwpwd} {cmd} -U {rwuser} -d {db} -h {rwhost} -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
write(" + Setup user roles")
|
||||
|
||||
q = ""
|
||||
q += f"GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO {rwuser};"
|
||||
q += f"GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO {rwuser};"
|
||||
res = execute(f'{cmd} -c "{q}" -d {db}')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
if rwuser != rouser:
|
||||
q = f"SELECT 1 FROM pg_roles WHERE rolname='{rouser}'"
|
||||
res = execute(cmd + f' -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
exits = "1" in res.data
|
||||
if not exits:
|
||||
write(f" + Create read-only user {rouser}")
|
||||
q = f"CREATE USER {rouser} WITH ENCRYPTED PASSWORD '{ropwd}';"
|
||||
res = execute(f'{cmd} -c "{q}"')
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
q = f"GRANT SELECT ON ALL TABLES IN SCHEMA public TO {rouser};"
|
||||
if res.error:
|
||||
print(f" + {res.error}")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 9:
|
||||
print(
|
||||
"Usage: postgres_setup.py <db> <rwuser> <rwpwd> "
|
||||
"<rouser> <ropwd> <rwhost> <drop> <schema path>\n\n"
|
||||
"For example: su postgres -c postgres_setup.py seiscomp sysop sysop "
|
||||
"sysop sysop localhost false ~/seiscomp/share/db/"
|
||||
)
|
||||
return 1
|
||||
|
||||
db = sys.argv[1]
|
||||
rwuser = sys.argv[2]
|
||||
rwpwd = sys.argv[3]
|
||||
rouser = sys.argv[4]
|
||||
ropwd = sys.argv[5]
|
||||
rwhost = sys.argv[6]
|
||||
schemapath = sys.argv[8]
|
||||
|
||||
drop = sys.argv[7].lower() == "true"
|
||||
|
||||
os.chdir(tempfile.gettempdir())
|
||||
if not createPostgresSQLDB(
|
||||
db, rwuser, rwpwd, rouser, ropwd, rwhost, drop, schemapath
|
||||
):
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
2206
share/db/sqlite3.sql
Normal file
2206
share/db/sqlite3.sql
Normal file
File diff suppressed because it is too large
Load Diff
67
share/db/sqlite3_setup.py
Executable file
67
share/db/sqlite3_setup.py
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env seiscomp-python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
############################################################################
|
||||
# Copyright (C) 2016 by gempa GmbH #
|
||||
# #
|
||||
# All Rights Reserved. #
|
||||
# #
|
||||
# NOTICE: All information contained herein is, and remains #
|
||||
# the property of gempa GmbH and its suppliers, if any. The intellectual #
|
||||
# and technical concepts contained herein are proprietary to gempa GmbH #
|
||||
# and its suppliers. #
|
||||
# Dissemination of this information or reproduction of this material #
|
||||
# is strictly forbidden unless prior written permission is obtained #
|
||||
# from gempa GmbH. #
|
||||
############################################################################
|
||||
|
||||
from __future__ import (
|
||||
absolute_import,
|
||||
print_function)
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from utils import write, execute
|
||||
|
||||
def createSQLite3DB(filename, schemapath, override):
|
||||
cmd = "sqlite3 {} < {}".format(filename, os.path.join(schemapath, "sqlite3.sql"))
|
||||
write("+ Create SQLite3 database at '{}'".format(filename))
|
||||
|
||||
if os.path.exists(filename) and not override:
|
||||
print("+ Database file '{}' exists".format(filename))
|
||||
return False
|
||||
|
||||
path = os.path.dirname(filename)
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as err:
|
||||
print("+ Could not create directory '{}': {} ".format(path, err))
|
||||
return False
|
||||
|
||||
res = execute(cmd)
|
||||
if res.error:
|
||||
print(" + {}".format(res.error))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 4:
|
||||
print("Usage: sqlite3_setup.py <filename> ~/seiscomp/share/db/ <override>")
|
||||
return 1
|
||||
|
||||
filename = sys.argv[1]
|
||||
schemapath = sys.argv[2]
|
||||
override = sys.argv[3].lower() == "true"
|
||||
|
||||
os.chdir(tempfile.gettempdir())
|
||||
if not createSQLite3DB(filename, schemapath, override):
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
62
share/db/utils.py
Executable file
62
share/db/utils.py
Executable file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env seiscomp-python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
############################################################################
|
||||
# Copyright (C) 2016 by gempa GmbH #
|
||||
# #
|
||||
# All Rights Reserved. #
|
||||
# #
|
||||
# NOTICE: All information contained herein is, and remains #
|
||||
# the property of gempa GmbH and its suppliers, if any. The intellectual #
|
||||
# and technical concepts contained herein are proprietary to gempa GmbH #
|
||||
# and its suppliers. #
|
||||
# Dissemination of this information or reproduction of this material #
|
||||
# is strictly forbidden unless prior written permission is obtained #
|
||||
# from gempa GmbH. #
|
||||
############################################################################
|
||||
|
||||
from __future__ import (
|
||||
absolute_import,
|
||||
print_function)
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Python version depended string conversion
|
||||
if sys.version_info[0] < 3:
|
||||
py3bstr = str
|
||||
py3ustr = str
|
||||
|
||||
else:
|
||||
py3bstr = lambda s: s.encode('utf-8')
|
||||
py3ustr = lambda s: s.decode('utf-8', 'replace')
|
||||
|
||||
class ProcResult:
|
||||
def __init__(self):
|
||||
self.error = ""
|
||||
self.data = ""
|
||||
|
||||
def execute(cmd):
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
shell=True)
|
||||
out = proc.communicate()
|
||||
|
||||
res = ProcResult()
|
||||
res.data = py3ustr(out[0].strip())
|
||||
if proc.returncode != 0:
|
||||
res.error = py3ustr(out[1].strip())
|
||||
if not res.error:
|
||||
res.error = "Error: Process returned exit code: {}".format(proc.returncode)
|
||||
else:
|
||||
# Ignore any stderr output in case of the exit code is 0
|
||||
res.error = None
|
||||
|
||||
return res
|
||||
|
||||
def write(msg):
|
||||
print(msg)
|
||||
sys.stdout.flush()
|
410
share/db/wfparam/mysql.sql
Normal file
410
share/db/wfparam/mysql.sql
Normal file
@ -0,0 +1,410 @@
|
||||
DROP TABLE IF EXISTS FilterParameter;
|
||||
DROP TABLE IF EXISTS SimpleFilter;
|
||||
DROP TABLE IF EXISTS SimpleFilterChainMember;
|
||||
DROP TABLE IF EXISTS PeakMotion;
|
||||
DROP TABLE IF EXISTS Record;
|
||||
DROP TABLE IF EXISTS EventRecordReference;
|
||||
DROP TABLE IF EXISTS Rupture;
|
||||
DROP TABLE IF EXISTS StrongOriginDescription;
|
||||
|
||||
INSERT INTO Object(_oid) VALUES (NULL);
|
||||
INSERT INTO PublicObject(_oid,publicID) VALUES (LAST_INSERT_ID(),'StrongMotionParameters');
|
||||
|
||||
CREATE TABLE FilterParameter (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
value_value DOUBLE NOT NULL,
|
||||
value_uncertainty DOUBLE UNSIGNED,
|
||||
value_lowerUncertainty DOUBLE UNSIGNED,
|
||||
value_upperUncertainty DOUBLE UNSIGNED,
|
||||
value_confidenceLevel DOUBLE UNSIGNED,
|
||||
value_pdf_variable_content BLOB,
|
||||
value_pdf_probability_content BLOB,
|
||||
value_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
name VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE SimpleFilter (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
type VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE SimpleFilterChainMember (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
sequenceNo INT UNSIGNED NOT NULL,
|
||||
simpleFilterID VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(simpleFilterID),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE(_parent_oid,sequenceNo)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE PeakMotion (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
motion_value DOUBLE NOT NULL,
|
||||
motion_uncertainty DOUBLE UNSIGNED,
|
||||
motion_lowerUncertainty DOUBLE UNSIGNED,
|
||||
motion_upperUncertainty DOUBLE UNSIGNED,
|
||||
motion_confidenceLevel DOUBLE UNSIGNED,
|
||||
motion_pdf_variable_content BLOB,
|
||||
motion_pdf_probability_content BLOB,
|
||||
motion_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
type VARCHAR(255) NOT NULL,
|
||||
period DOUBLE UNSIGNED,
|
||||
damping DOUBLE UNSIGNED,
|
||||
method VARCHAR(255),
|
||||
atTime_value DATETIME,
|
||||
atTime_value_ms INTEGER,
|
||||
atTime_uncertainty DOUBLE UNSIGNED,
|
||||
atTime_lowerUncertainty DOUBLE UNSIGNED,
|
||||
atTime_upperUncertainty DOUBLE UNSIGNED,
|
||||
atTime_confidenceLevel DOUBLE UNSIGNED,
|
||||
atTime_pdf_variable_content BLOB,
|
||||
atTime_pdf_probability_content BLOB,
|
||||
atTime_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
atTime_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE Record (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
creationInfo_agencyID VARCHAR(64),
|
||||
creationInfo_agencyURI VARCHAR(255),
|
||||
creationInfo_author VARCHAR(128),
|
||||
creationInfo_authorURI VARCHAR(255),
|
||||
creationInfo_creationTime DATETIME,
|
||||
creationInfo_creationTime_ms INTEGER,
|
||||
creationInfo_modificationTime DATETIME,
|
||||
creationInfo_modificationTime_ms INTEGER,
|
||||
creationInfo_version VARCHAR(64),
|
||||
creationInfo_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
gainUnit CHAR(20),
|
||||
duration DOUBLE,
|
||||
startTime_value DATETIME NOT NULL,
|
||||
startTime_value_ms INTEGER NOT NULL,
|
||||
startTime_uncertainty DOUBLE UNSIGNED,
|
||||
startTime_lowerUncertainty DOUBLE UNSIGNED,
|
||||
startTime_upperUncertainty DOUBLE UNSIGNED,
|
||||
startTime_confidenceLevel DOUBLE UNSIGNED,
|
||||
startTime_pdf_variable_content BLOB,
|
||||
startTime_pdf_probability_content BLOB,
|
||||
startTime_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
owner_name VARCHAR(255),
|
||||
owner_forename VARCHAR(255),
|
||||
owner_agency VARCHAR(255),
|
||||
owner_department VARCHAR(255),
|
||||
owner_address VARCHAR(255),
|
||||
owner_phone VARCHAR(255),
|
||||
owner_email VARCHAR(255),
|
||||
owner_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
resampleRateNumerator INT UNSIGNED,
|
||||
resampleRateDenominator INT UNSIGNED,
|
||||
waveformID_networkCode CHAR(8) NOT NULL,
|
||||
waveformID_stationCode CHAR(8) NOT NULL,
|
||||
waveformID_locationCode CHAR(8),
|
||||
waveformID_channelCode CHAR(8),
|
||||
waveformID_resourceURI VARCHAR(255),
|
||||
waveformFile_creationInfo_agencyID VARCHAR(64),
|
||||
waveformFile_creationInfo_agencyURI VARCHAR(255),
|
||||
waveformFile_creationInfo_author VARCHAR(128),
|
||||
waveformFile_creationInfo_authorURI VARCHAR(255),
|
||||
waveformFile_creationInfo_creationTime DATETIME,
|
||||
waveformFile_creationInfo_creationTime_ms INTEGER,
|
||||
waveformFile_creationInfo_modificationTime DATETIME,
|
||||
waveformFile_creationInfo_modificationTime_ms INTEGER,
|
||||
waveformFile_creationInfo_version VARCHAR(64),
|
||||
waveformFile_creationInfo_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
waveformFile_class VARCHAR(255),
|
||||
waveformFile_type VARCHAR(255),
|
||||
waveformFile_filename VARCHAR(255),
|
||||
waveformFile_url VARCHAR(255),
|
||||
waveformFile_description VARCHAR(255),
|
||||
waveformFile_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE EventRecordReference (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
recordID VARCHAR(255) NOT NULL,
|
||||
campbellDistance_value DOUBLE,
|
||||
campbellDistance_uncertainty DOUBLE UNSIGNED,
|
||||
campbellDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
campbellDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
campbellDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
campbellDistance_pdf_variable_content BLOB,
|
||||
campbellDistance_pdf_probability_content BLOB,
|
||||
campbellDistance_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
campbellDistance_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ruptureToStationAzimuth_value DOUBLE,
|
||||
ruptureToStationAzimuth_uncertainty DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_lowerUncertainty DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_upperUncertainty DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_confidenceLevel DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_pdf_variable_content BLOB,
|
||||
ruptureToStationAzimuth_pdf_probability_content BLOB,
|
||||
ruptureToStationAzimuth_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ruptureToStationAzimuth_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ruptureAreaDistance_value DOUBLE,
|
||||
ruptureAreaDistance_uncertainty DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_pdf_variable_content BLOB,
|
||||
ruptureAreaDistance_pdf_probability_content BLOB,
|
||||
ruptureAreaDistance_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ruptureAreaDistance_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
JoynerBooreDistance_value DOUBLE,
|
||||
JoynerBooreDistance_uncertainty DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_pdf_variable_content BLOB,
|
||||
JoynerBooreDistance_pdf_probability_content BLOB,
|
||||
JoynerBooreDistance_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
JoynerBooreDistance_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
closestFaultDistance_value DOUBLE,
|
||||
closestFaultDistance_uncertainty DOUBLE UNSIGNED,
|
||||
closestFaultDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
closestFaultDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
closestFaultDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
closestFaultDistance_pdf_variable_content BLOB,
|
||||
closestFaultDistance_pdf_probability_content BLOB,
|
||||
closestFaultDistance_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
closestFaultDistance_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
preEventLength DOUBLE,
|
||||
postEventLength DOUBLE,
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(recordID),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE Rupture (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
width_value DOUBLE,
|
||||
width_uncertainty DOUBLE UNSIGNED,
|
||||
width_lowerUncertainty DOUBLE UNSIGNED,
|
||||
width_upperUncertainty DOUBLE UNSIGNED,
|
||||
width_confidenceLevel DOUBLE UNSIGNED,
|
||||
width_pdf_variable_content BLOB,
|
||||
width_pdf_probability_content BLOB,
|
||||
width_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
width_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
displacement_value DOUBLE,
|
||||
displacement_uncertainty DOUBLE UNSIGNED,
|
||||
displacement_lowerUncertainty DOUBLE UNSIGNED,
|
||||
displacement_upperUncertainty DOUBLE UNSIGNED,
|
||||
displacement_confidenceLevel DOUBLE UNSIGNED,
|
||||
displacement_pdf_variable_content BLOB,
|
||||
displacement_pdf_probability_content BLOB,
|
||||
displacement_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
displacement_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
riseTime_value DOUBLE,
|
||||
riseTime_uncertainty DOUBLE UNSIGNED,
|
||||
riseTime_lowerUncertainty DOUBLE UNSIGNED,
|
||||
riseTime_upperUncertainty DOUBLE UNSIGNED,
|
||||
riseTime_confidenceLevel DOUBLE UNSIGNED,
|
||||
riseTime_pdf_variable_content BLOB,
|
||||
riseTime_pdf_probability_content BLOB,
|
||||
riseTime_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
riseTime_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
vt_to_vs_value DOUBLE,
|
||||
vt_to_vs_uncertainty DOUBLE UNSIGNED,
|
||||
vt_to_vs_lowerUncertainty DOUBLE UNSIGNED,
|
||||
vt_to_vs_upperUncertainty DOUBLE UNSIGNED,
|
||||
vt_to_vs_confidenceLevel DOUBLE UNSIGNED,
|
||||
vt_to_vs_pdf_variable_content BLOB,
|
||||
vt_to_vs_pdf_probability_content BLOB,
|
||||
vt_to_vs_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
vt_to_vs_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
shallowAsperityDepth_value DOUBLE,
|
||||
shallowAsperityDepth_uncertainty DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_lowerUncertainty DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_upperUncertainty DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_confidenceLevel DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_pdf_variable_content BLOB,
|
||||
shallowAsperityDepth_pdf_probability_content BLOB,
|
||||
shallowAsperityDepth_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
shallowAsperityDepth_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
shallowAsperity TINYINT(1),
|
||||
literatureSource_title VARCHAR(255),
|
||||
literatureSource_firstAuthorName VARCHAR(255),
|
||||
literatureSource_firstAuthorForename VARCHAR(255),
|
||||
literatureSource_secondaryAuthors VARCHAR(255),
|
||||
literatureSource_doi VARCHAR(255),
|
||||
literatureSource_year INT UNSIGNED,
|
||||
literatureSource_in_title VARCHAR(255),
|
||||
literatureSource_editor VARCHAR(255),
|
||||
literatureSource_place VARCHAR(255),
|
||||
literatureSource_language VARCHAR(255),
|
||||
literatureSource_tome INT UNSIGNED,
|
||||
literatureSource_page_from INT UNSIGNED,
|
||||
literatureSource_page_to INT UNSIGNED,
|
||||
literatureSource_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
slipVelocity_value DOUBLE,
|
||||
slipVelocity_uncertainty DOUBLE UNSIGNED,
|
||||
slipVelocity_lowerUncertainty DOUBLE UNSIGNED,
|
||||
slipVelocity_upperUncertainty DOUBLE UNSIGNED,
|
||||
slipVelocity_confidenceLevel DOUBLE UNSIGNED,
|
||||
slipVelocity_pdf_variable_content BLOB,
|
||||
slipVelocity_pdf_probability_content BLOB,
|
||||
slipVelocity_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
slipVelocity_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
strike_value DOUBLE,
|
||||
strike_uncertainty DOUBLE UNSIGNED,
|
||||
strike_lowerUncertainty DOUBLE UNSIGNED,
|
||||
strike_upperUncertainty DOUBLE UNSIGNED,
|
||||
strike_confidenceLevel DOUBLE UNSIGNED,
|
||||
strike_pdf_variable_content BLOB,
|
||||
strike_pdf_probability_content BLOB,
|
||||
strike_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
strike_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
length_value DOUBLE,
|
||||
length_uncertainty DOUBLE UNSIGNED,
|
||||
length_lowerUncertainty DOUBLE UNSIGNED,
|
||||
length_upperUncertainty DOUBLE UNSIGNED,
|
||||
length_confidenceLevel DOUBLE UNSIGNED,
|
||||
length_pdf_variable_content BLOB,
|
||||
length_pdf_probability_content BLOB,
|
||||
length_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
length_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
area_value DOUBLE,
|
||||
area_uncertainty DOUBLE UNSIGNED,
|
||||
area_lowerUncertainty DOUBLE UNSIGNED,
|
||||
area_upperUncertainty DOUBLE UNSIGNED,
|
||||
area_confidenceLevel DOUBLE UNSIGNED,
|
||||
area_pdf_variable_content BLOB,
|
||||
area_pdf_probability_content BLOB,
|
||||
area_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
area_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ruptureVelocity_value DOUBLE,
|
||||
ruptureVelocity_uncertainty DOUBLE UNSIGNED,
|
||||
ruptureVelocity_lowerUncertainty DOUBLE UNSIGNED,
|
||||
ruptureVelocity_upperUncertainty DOUBLE UNSIGNED,
|
||||
ruptureVelocity_confidenceLevel DOUBLE UNSIGNED,
|
||||
ruptureVelocity_pdf_variable_content BLOB,
|
||||
ruptureVelocity_pdf_probability_content BLOB,
|
||||
ruptureVelocity_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
ruptureVelocity_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
stressdrop_value DOUBLE,
|
||||
stressdrop_uncertainty DOUBLE UNSIGNED,
|
||||
stressdrop_lowerUncertainty DOUBLE UNSIGNED,
|
||||
stressdrop_upperUncertainty DOUBLE UNSIGNED,
|
||||
stressdrop_confidenceLevel DOUBLE UNSIGNED,
|
||||
stressdrop_pdf_variable_content BLOB,
|
||||
stressdrop_pdf_probability_content BLOB,
|
||||
stressdrop_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
stressdrop_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
momentReleaseTop5km_value DOUBLE,
|
||||
momentReleaseTop5km_uncertainty DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_lowerUncertainty DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_upperUncertainty DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_confidenceLevel DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_pdf_variable_content BLOB,
|
||||
momentReleaseTop5km_pdf_probability_content BLOB,
|
||||
momentReleaseTop5km_pdf_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
momentReleaseTop5km_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
fwHwIndicator VARCHAR(64),
|
||||
ruptureGeometryWKT VARCHAR(255),
|
||||
faultID VARCHAR(255) NOT NULL,
|
||||
surfaceRupture_observed TINYINT(1),
|
||||
surfaceRupture_evidence VARCHAR(255),
|
||||
surfaceRupture_literatureSource_title VARCHAR(255),
|
||||
surfaceRupture_literatureSource_firstAuthorName VARCHAR(255),
|
||||
surfaceRupture_literatureSource_firstAuthorForename VARCHAR(255),
|
||||
surfaceRupture_literatureSource_secondaryAuthors VARCHAR(255),
|
||||
surfaceRupture_literatureSource_doi VARCHAR(255),
|
||||
surfaceRupture_literatureSource_year INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_in_title VARCHAR(255),
|
||||
surfaceRupture_literatureSource_editor VARCHAR(255),
|
||||
surfaceRupture_literatureSource_place VARCHAR(255),
|
||||
surfaceRupture_literatureSource_language VARCHAR(255),
|
||||
surfaceRupture_literatureSource_tome INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_page_from INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_page_to INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
surfaceRupture_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
centroidReference VARCHAR(255),
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(ruptureGeometryWKT),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE StrongOriginDescription (
|
||||
_oid BIGINT(20) NOT NULL,
|
||||
_parent_oid BIGINT(20) NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
originID VARCHAR(255) NOT NULL,
|
||||
waveformCount INT UNSIGNED,
|
||||
creationInfo_agencyID VARCHAR(64),
|
||||
creationInfo_agencyURI VARCHAR(255),
|
||||
creationInfo_author VARCHAR(128),
|
||||
creationInfo_authorURI VARCHAR(255),
|
||||
creationInfo_creationTime DATETIME,
|
||||
creationInfo_creationTime_ms INTEGER,
|
||||
creationInfo_modificationTime DATETIME,
|
||||
creationInfo_modificationTime_ms INTEGER,
|
||||
creationInfo_version VARCHAR(64),
|
||||
creationInfo_used TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
INDEX(originID),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=INNODB;
|
442
share/db/wfparam/postgres.sql
Normal file
442
share/db/wfparam/postgres.sql
Normal file
@ -0,0 +1,442 @@
|
||||
DROP TABLE FilterParameter;
|
||||
DROP TABLE SimpleFilter;
|
||||
DROP TABLE SimpleFilterChainMember;
|
||||
DROP TABLE PeakMotion;
|
||||
DROP TABLE Record;
|
||||
DROP TABLE EventRecordReference;
|
||||
DROP TABLE Rupture;
|
||||
DROP TABLE StrongOriginDescription;
|
||||
|
||||
INSERT INTO Object(_oid) VALUES (DEFAULT);
|
||||
INSERT INTO PublicObject(_oid,m_publicID) VALUES (CURRVAL('Object_seq'),'StrongMotionParameters');
|
||||
|
||||
CREATE TABLE FilterParameter (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_value_value DOUBLE PRECISION NOT NULL,
|
||||
m_value_uncertainty DOUBLE PRECISION,
|
||||
m_value_lowerUncertainty DOUBLE PRECISION,
|
||||
m_value_upperUncertainty DOUBLE PRECISION,
|
||||
m_value_confidenceLevel DOUBLE PRECISION,
|
||||
m_value_pdf_variable_content BYTEA,
|
||||
m_value_pdf_probability_content BYTEA,
|
||||
m_value_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_name VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER FilterParameter_update BEFORE UPDATE ON FilterParameter FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE SimpleFilter (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_type VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER SimpleFilter_update BEFORE UPDATE ON SimpleFilter FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE SimpleFilterChainMember (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_sequenceNo INT NOT NULL,
|
||||
m_simpleFilterID VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE(_parent_oid,m_sequenceNo)
|
||||
);
|
||||
|
||||
CREATE INDEX SimpleFilterChainMember_m_simpleFilterID ON SimpleFilterChainMember(m_simpleFilterID);
|
||||
|
||||
CREATE TRIGGER SimpleFilterChainMember_update BEFORE UPDATE ON SimpleFilterChainMember FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE PeakMotion (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_motion_value DOUBLE PRECISION NOT NULL,
|
||||
m_motion_uncertainty DOUBLE PRECISION,
|
||||
m_motion_lowerUncertainty DOUBLE PRECISION,
|
||||
m_motion_upperUncertainty DOUBLE PRECISION,
|
||||
m_motion_confidenceLevel DOUBLE PRECISION,
|
||||
m_motion_pdf_variable_content BYTEA,
|
||||
m_motion_pdf_probability_content BYTEA,
|
||||
m_motion_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_type VARCHAR(255) NOT NULL,
|
||||
m_period DOUBLE PRECISION,
|
||||
m_damping DOUBLE PRECISION,
|
||||
m_method VARCHAR(255),
|
||||
m_atTime_value TIMESTAMP,
|
||||
m_atTime_value_ms INTEGER,
|
||||
m_atTime_uncertainty DOUBLE PRECISION,
|
||||
m_atTime_lowerUncertainty DOUBLE PRECISION,
|
||||
m_atTime_upperUncertainty DOUBLE PRECISION,
|
||||
m_atTime_confidenceLevel DOUBLE PRECISION,
|
||||
m_atTime_pdf_variable_content BYTEA,
|
||||
m_atTime_pdf_probability_content BYTEA,
|
||||
m_atTime_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_atTime_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER PeakMotion_update BEFORE UPDATE ON PeakMotion FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE Record (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_creationInfo_agencyID VARCHAR(64),
|
||||
m_creationInfo_agencyURI VARCHAR(255),
|
||||
m_creationInfo_author VARCHAR(128),
|
||||
m_creationInfo_authorURI VARCHAR(255),
|
||||
m_creationInfo_creationTime TIMESTAMP,
|
||||
m_creationInfo_creationTime_ms INTEGER,
|
||||
m_creationInfo_modificationTime TIMESTAMP,
|
||||
m_creationInfo_modificationTime_ms INTEGER,
|
||||
m_creationInfo_version VARCHAR(64),
|
||||
m_creationInfo_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_gainUnit VARCHAR(20),
|
||||
m_duration DOUBLE PRECISION,
|
||||
m_startTime_value TIMESTAMP NOT NULL,
|
||||
m_startTime_value_ms INTEGER NOT NULL,
|
||||
m_startTime_uncertainty DOUBLE PRECISION,
|
||||
m_startTime_lowerUncertainty DOUBLE PRECISION,
|
||||
m_startTime_upperUncertainty DOUBLE PRECISION,
|
||||
m_startTime_confidenceLevel DOUBLE PRECISION,
|
||||
m_startTime_pdf_variable_content BYTEA,
|
||||
m_startTime_pdf_probability_content BYTEA,
|
||||
m_startTime_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_owner_name VARCHAR(255),
|
||||
m_owner_forename VARCHAR(255),
|
||||
m_owner_agency VARCHAR(255),
|
||||
m_owner_department VARCHAR(255),
|
||||
m_owner_address VARCHAR(255),
|
||||
m_owner_phone VARCHAR(255),
|
||||
m_owner_email VARCHAR(255),
|
||||
m_owner_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_resampleRateNumerator INT,
|
||||
m_resampleRateDenominator INT,
|
||||
m_waveformID_networkCode VARCHAR(8) NOT NULL,
|
||||
m_waveformID_stationCode VARCHAR(8) NOT NULL,
|
||||
m_waveformID_locationCode VARCHAR(8),
|
||||
m_waveformID_channelCode VARCHAR(8),
|
||||
m_waveformID_resourceURI VARCHAR(255),
|
||||
m_waveformFile_creationInfo_agencyID VARCHAR(64),
|
||||
m_waveformFile_creationInfo_agencyURI VARCHAR(255),
|
||||
m_waveformFile_creationInfo_author VARCHAR(128),
|
||||
m_waveformFile_creationInfo_authorURI VARCHAR(255),
|
||||
m_waveformFile_creationInfo_creationTime TIMESTAMP,
|
||||
m_waveformFile_creationInfo_creationTime_ms INTEGER,
|
||||
m_waveformFile_creationInfo_modificationTime TIMESTAMP,
|
||||
m_waveformFile_creationInfo_modificationTime_ms INTEGER,
|
||||
m_waveformFile_creationInfo_version VARCHAR(64),
|
||||
m_waveformFile_creationInfo_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_waveformFile_class VARCHAR(255),
|
||||
m_waveformFile_type VARCHAR(255),
|
||||
m_waveformFile_filename VARCHAR(255),
|
||||
m_waveformFile_url VARCHAR(255),
|
||||
m_waveformFile_description VARCHAR(255),
|
||||
m_waveformFile_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER Record_update BEFORE UPDATE ON Record FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE EventRecordReference (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_recordID VARCHAR(255) NOT NULL,
|
||||
m_campbellDistance_value DOUBLE PRECISION,
|
||||
m_campbellDistance_uncertainty DOUBLE PRECISION,
|
||||
m_campbellDistance_lowerUncertainty DOUBLE PRECISION,
|
||||
m_campbellDistance_upperUncertainty DOUBLE PRECISION,
|
||||
m_campbellDistance_confidenceLevel DOUBLE PRECISION,
|
||||
m_campbellDistance_pdf_variable_content BYTEA,
|
||||
m_campbellDistance_pdf_probability_content BYTEA,
|
||||
m_campbellDistance_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_campbellDistance_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_ruptureToStationAzimuth_value DOUBLE PRECISION,
|
||||
m_ruptureToStationAzimuth_uncertainty DOUBLE PRECISION,
|
||||
m_ruptureToStationAzimuth_lowerUncertainty DOUBLE PRECISION,
|
||||
m_ruptureToStationAzimuth_upperUncertainty DOUBLE PRECISION,
|
||||
m_ruptureToStationAzimuth_confidenceLevel DOUBLE PRECISION,
|
||||
m_ruptureToStationAzimuth_pdf_variable_content BYTEA,
|
||||
m_ruptureToStationAzimuth_pdf_probability_content BYTEA,
|
||||
m_ruptureToStationAzimuth_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_ruptureToStationAzimuth_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_ruptureAreaDistance_value DOUBLE PRECISION,
|
||||
m_ruptureAreaDistance_uncertainty DOUBLE PRECISION,
|
||||
m_ruptureAreaDistance_lowerUncertainty DOUBLE PRECISION,
|
||||
m_ruptureAreaDistance_upperUncertainty DOUBLE PRECISION,
|
||||
m_ruptureAreaDistance_confidenceLevel DOUBLE PRECISION,
|
||||
m_ruptureAreaDistance_pdf_variable_content BYTEA,
|
||||
m_ruptureAreaDistance_pdf_probability_content BYTEA,
|
||||
m_ruptureAreaDistance_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_ruptureAreaDistance_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_JoynerBooreDistance_value DOUBLE PRECISION,
|
||||
m_JoynerBooreDistance_uncertainty DOUBLE PRECISION,
|
||||
m_JoynerBooreDistance_lowerUncertainty DOUBLE PRECISION,
|
||||
m_JoynerBooreDistance_upperUncertainty DOUBLE PRECISION,
|
||||
m_JoynerBooreDistance_confidenceLevel DOUBLE PRECISION,
|
||||
m_JoynerBooreDistance_pdf_variable_content BYTEA,
|
||||
m_JoynerBooreDistance_pdf_probability_content BYTEA,
|
||||
m_JoynerBooreDistance_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_JoynerBooreDistance_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_closestFaultDistance_value DOUBLE PRECISION,
|
||||
m_closestFaultDistance_uncertainty DOUBLE PRECISION,
|
||||
m_closestFaultDistance_lowerUncertainty DOUBLE PRECISION,
|
||||
m_closestFaultDistance_upperUncertainty DOUBLE PRECISION,
|
||||
m_closestFaultDistance_confidenceLevel DOUBLE PRECISION,
|
||||
m_closestFaultDistance_pdf_variable_content BYTEA,
|
||||
m_closestFaultDistance_pdf_probability_content BYTEA,
|
||||
m_closestFaultDistance_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_closestFaultDistance_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_preEventLength DOUBLE PRECISION,
|
||||
m_postEventLength DOUBLE PRECISION,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX EventRecordReference_m_recordID ON EventRecordReference(m_recordID);
|
||||
|
||||
CREATE TRIGGER EventRecordReference_update BEFORE UPDATE ON EventRecordReference FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE Rupture (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_width_value DOUBLE PRECISION,
|
||||
m_width_uncertainty DOUBLE PRECISION,
|
||||
m_width_lowerUncertainty DOUBLE PRECISION,
|
||||
m_width_upperUncertainty DOUBLE PRECISION,
|
||||
m_width_confidenceLevel DOUBLE PRECISION,
|
||||
m_width_pdf_variable_content BYTEA,
|
||||
m_width_pdf_probability_content BYTEA,
|
||||
m_width_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_width_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_displacement_value DOUBLE PRECISION,
|
||||
m_displacement_uncertainty DOUBLE PRECISION,
|
||||
m_displacement_lowerUncertainty DOUBLE PRECISION,
|
||||
m_displacement_upperUncertainty DOUBLE PRECISION,
|
||||
m_displacement_confidenceLevel DOUBLE PRECISION,
|
||||
m_displacement_pdf_variable_content BYTEA,
|
||||
m_displacement_pdf_probability_content BYTEA,
|
||||
m_displacement_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_displacement_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_riseTime_value DOUBLE PRECISION,
|
||||
m_riseTime_uncertainty DOUBLE PRECISION,
|
||||
m_riseTime_lowerUncertainty DOUBLE PRECISION,
|
||||
m_riseTime_upperUncertainty DOUBLE PRECISION,
|
||||
m_riseTime_confidenceLevel DOUBLE PRECISION,
|
||||
m_riseTime_pdf_variable_content BYTEA,
|
||||
m_riseTime_pdf_probability_content BYTEA,
|
||||
m_riseTime_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_riseTime_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_vt_to_vs_value DOUBLE PRECISION,
|
||||
m_vt_to_vs_uncertainty DOUBLE PRECISION,
|
||||
m_vt_to_vs_lowerUncertainty DOUBLE PRECISION,
|
||||
m_vt_to_vs_upperUncertainty DOUBLE PRECISION,
|
||||
m_vt_to_vs_confidenceLevel DOUBLE PRECISION,
|
||||
m_vt_to_vs_pdf_variable_content BYTEA,
|
||||
m_vt_to_vs_pdf_probability_content BYTEA,
|
||||
m_vt_to_vs_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_vt_to_vs_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_shallowAsperityDepth_value DOUBLE PRECISION,
|
||||
m_shallowAsperityDepth_uncertainty DOUBLE PRECISION,
|
||||
m_shallowAsperityDepth_lowerUncertainty DOUBLE PRECISION,
|
||||
m_shallowAsperityDepth_upperUncertainty DOUBLE PRECISION,
|
||||
m_shallowAsperityDepth_confidenceLevel DOUBLE PRECISION,
|
||||
m_shallowAsperityDepth_pdf_variable_content BYTEA,
|
||||
m_shallowAsperityDepth_pdf_probability_content BYTEA,
|
||||
m_shallowAsperityDepth_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_shallowAsperityDepth_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_shallowAsperity BOOLEAN,
|
||||
m_literatureSource_title VARCHAR(255),
|
||||
m_literatureSource_firstAuthorName VARCHAR(255),
|
||||
m_literatureSource_firstAuthorForename VARCHAR(255),
|
||||
m_literatureSource_secondaryAuthors VARCHAR(255),
|
||||
m_literatureSource_doi VARCHAR(255),
|
||||
m_literatureSource_year INT,
|
||||
m_literatureSource_in_title VARCHAR(255),
|
||||
m_literatureSource_editor VARCHAR(255),
|
||||
m_literatureSource_place VARCHAR(255),
|
||||
m_literatureSource_language VARCHAR(255),
|
||||
m_literatureSource_tome INT,
|
||||
m_literatureSource_page_from INT,
|
||||
m_literatureSource_page_to INT,
|
||||
m_literatureSource_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_slipVelocity_value DOUBLE PRECISION,
|
||||
m_slipVelocity_uncertainty DOUBLE PRECISION,
|
||||
m_slipVelocity_lowerUncertainty DOUBLE PRECISION,
|
||||
m_slipVelocity_upperUncertainty DOUBLE PRECISION,
|
||||
m_slipVelocity_confidenceLevel DOUBLE PRECISION,
|
||||
m_slipVelocity_pdf_variable_content BYTEA,
|
||||
m_slipVelocity_pdf_probability_content BYTEA,
|
||||
m_slipVelocity_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_slipVelocity_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_strike_value DOUBLE PRECISION,
|
||||
m_strike_uncertainty DOUBLE PRECISION,
|
||||
m_strike_lowerUncertainty DOUBLE PRECISION,
|
||||
m_strike_upperUncertainty DOUBLE PRECISION,
|
||||
m_strike_confidenceLevel DOUBLE PRECISION,
|
||||
m_strike_pdf_variable_content BYTEA,
|
||||
m_strike_pdf_probability_content BYTEA,
|
||||
m_strike_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_strike_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_length_value DOUBLE PRECISION,
|
||||
m_length_uncertainty DOUBLE PRECISION,
|
||||
m_length_lowerUncertainty DOUBLE PRECISION,
|
||||
m_length_upperUncertainty DOUBLE PRECISION,
|
||||
m_length_confidenceLevel DOUBLE PRECISION,
|
||||
m_length_pdf_variable_content BYTEA,
|
||||
m_length_pdf_probability_content BYTEA,
|
||||
m_length_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_length_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_area_value DOUBLE PRECISION,
|
||||
m_area_uncertainty DOUBLE PRECISION,
|
||||
m_area_lowerUncertainty DOUBLE PRECISION,
|
||||
m_area_upperUncertainty DOUBLE PRECISION,
|
||||
m_area_confidenceLevel DOUBLE PRECISION,
|
||||
m_area_pdf_variable_content BYTEA,
|
||||
m_area_pdf_probability_content BYTEA,
|
||||
m_area_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_area_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_ruptureVelocity_value DOUBLE PRECISION,
|
||||
m_ruptureVelocity_uncertainty DOUBLE PRECISION,
|
||||
m_ruptureVelocity_lowerUncertainty DOUBLE PRECISION,
|
||||
m_ruptureVelocity_upperUncertainty DOUBLE PRECISION,
|
||||
m_ruptureVelocity_confidenceLevel DOUBLE PRECISION,
|
||||
m_ruptureVelocity_pdf_variable_content BYTEA,
|
||||
m_ruptureVelocity_pdf_probability_content BYTEA,
|
||||
m_ruptureVelocity_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_ruptureVelocity_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_stressdrop_value DOUBLE PRECISION,
|
||||
m_stressdrop_uncertainty DOUBLE PRECISION,
|
||||
m_stressdrop_lowerUncertainty DOUBLE PRECISION,
|
||||
m_stressdrop_upperUncertainty DOUBLE PRECISION,
|
||||
m_stressdrop_confidenceLevel DOUBLE PRECISION,
|
||||
m_stressdrop_pdf_variable_content BYTEA,
|
||||
m_stressdrop_pdf_probability_content BYTEA,
|
||||
m_stressdrop_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_stressdrop_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_momentReleaseTop5km_value DOUBLE PRECISION,
|
||||
m_momentReleaseTop5km_uncertainty DOUBLE PRECISION,
|
||||
m_momentReleaseTop5km_lowerUncertainty DOUBLE PRECISION,
|
||||
m_momentReleaseTop5km_upperUncertainty DOUBLE PRECISION,
|
||||
m_momentReleaseTop5km_confidenceLevel DOUBLE PRECISION,
|
||||
m_momentReleaseTop5km_pdf_variable_content BYTEA,
|
||||
m_momentReleaseTop5km_pdf_probability_content BYTEA,
|
||||
m_momentReleaseTop5km_pdf_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_momentReleaseTop5km_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_fwHwIndicator VARCHAR(64),
|
||||
m_ruptureGeometryWKT VARCHAR(255),
|
||||
m_faultID VARCHAR(255) NOT NULL,
|
||||
m_surfaceRupture_observed BOOLEAN,
|
||||
m_surfaceRupture_evidence VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_title VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_firstAuthorName VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_firstAuthorForename VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_secondaryAuthors VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_doi VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_year INT,
|
||||
m_surfaceRupture_literatureSource_in_title VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_editor VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_place VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_language VARCHAR(255),
|
||||
m_surfaceRupture_literatureSource_tome INT,
|
||||
m_surfaceRupture_literatureSource_page_from INT,
|
||||
m_surfaceRupture_literatureSource_page_to INT,
|
||||
m_surfaceRupture_literatureSource_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_surfaceRupture_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
m_centroidReference VARCHAR(255),
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX Rupture_m_ruptureGeometryWKT ON Rupture(m_ruptureGeometryWKT);
|
||||
|
||||
CREATE TRIGGER Rupture_update BEFORE UPDATE ON Rupture FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
||||
|
||||
CREATE TABLE StrongOriginDescription (
|
||||
_oid BIGINT NOT NULL,
|
||||
_parent_oid BIGINT NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
m_originID VARCHAR(255) NOT NULL,
|
||||
m_waveformCount INT,
|
||||
m_creationInfo_agencyID VARCHAR(64),
|
||||
m_creationInfo_agencyURI VARCHAR(255),
|
||||
m_creationInfo_author VARCHAR(128),
|
||||
m_creationInfo_authorURI VARCHAR(255),
|
||||
m_creationInfo_creationTime TIMESTAMP,
|
||||
m_creationInfo_creationTime_ms INTEGER,
|
||||
m_creationInfo_modificationTime TIMESTAMP,
|
||||
m_creationInfo_modificationTime_ms INTEGER,
|
||||
m_creationInfo_version VARCHAR(64),
|
||||
m_creationInfo_used BOOLEAN NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX StrongOriginDescription_m_originID ON StrongOriginDescription(m_originID);
|
||||
|
||||
CREATE TRIGGER StrongOriginDescription_update BEFORE UPDATE ON StrongOriginDescription FOR EACH ROW EXECUTE PROCEDURE update_modified();
|
||||
|
458
share/db/wfparam/sqlite3.sql
Normal file
458
share/db/wfparam/sqlite3.sql
Normal file
@ -0,0 +1,458 @@
|
||||
DROP TABLE IF EXISTS FilterParameter;
|
||||
DROP TABLE IF EXISTS SimpleFilter;
|
||||
DROP TABLE IF EXISTS SimpleFilterChainMember;
|
||||
DROP TABLE IF EXISTS PeakMotion;
|
||||
DROP TABLE IF EXISTS Record;
|
||||
DROP TABLE IF EXISTS EventRecordReference;
|
||||
DROP TABLE IF EXISTS Rupture;
|
||||
DROP TABLE IF EXISTS StrongOriginDescription;
|
||||
|
||||
INSERT INTO Object(_oid) VALUES (NULL);
|
||||
INSERT INTO PublicObject(_oid,publicID) VALUES ((SELECT MAX(_oid) FROM Object),'StrongMotionParameters');
|
||||
|
||||
CREATE TABLE FilterParameter (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
value_value DOUBLE NOT NULL,
|
||||
value_uncertainty DOUBLE UNSIGNED,
|
||||
value_lowerUncertainty DOUBLE UNSIGNED,
|
||||
value_upperUncertainty DOUBLE UNSIGNED,
|
||||
value_confidenceLevel DOUBLE UNSIGNED,
|
||||
value_pdf_variable_content BLOB,
|
||||
value_pdf_probability_content BLOB,
|
||||
value_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
name VARCHAR NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER FilterParameterUpdate UPDATE ON FilterParameter
|
||||
BEGIN
|
||||
UPDATE FilterParameter SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE SimpleFilter (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
type VARCHAR NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER SimpleFilterUpdate UPDATE ON SimpleFilter
|
||||
BEGIN
|
||||
UPDATE SimpleFilter SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE SimpleFilterChainMember (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
sequenceNo INT UNSIGNED NOT NULL,
|
||||
simpleFilterID VARCHAR NOT NULL,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
UNIQUE(_parent_oid,sequenceNo)
|
||||
);
|
||||
|
||||
CREATE INDEX SimpleFilterChainMember_simpleFilterID ON SimpleFilterChainMember(simpleFilterID);
|
||||
|
||||
CREATE TRIGGER SimpleFilterChainMemberUpdate UPDATE ON SimpleFilterChainMember
|
||||
BEGIN
|
||||
UPDATE SimpleFilterChainMember SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE PeakMotion (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
motion_value DOUBLE NOT NULL,
|
||||
motion_uncertainty DOUBLE UNSIGNED,
|
||||
motion_lowerUncertainty DOUBLE UNSIGNED,
|
||||
motion_upperUncertainty DOUBLE UNSIGNED,
|
||||
motion_confidenceLevel DOUBLE UNSIGNED,
|
||||
motion_pdf_variable_content BLOB,
|
||||
motion_pdf_probability_content BLOB,
|
||||
motion_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
type VARCHAR NOT NULL,
|
||||
period DOUBLE UNSIGNED,
|
||||
damping DOUBLE UNSIGNED,
|
||||
method VARCHAR,
|
||||
atTime_value DATETIME,
|
||||
atTime_value_ms INTEGER,
|
||||
atTime_uncertainty DOUBLE UNSIGNED,
|
||||
atTime_lowerUncertainty DOUBLE UNSIGNED,
|
||||
atTime_upperUncertainty DOUBLE UNSIGNED,
|
||||
atTime_confidenceLevel DOUBLE UNSIGNED,
|
||||
atTime_pdf_variable_content BLOB,
|
||||
atTime_pdf_probability_content BLOB,
|
||||
atTime_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
atTime_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER PeakMotionUpdate UPDATE ON PeakMotion
|
||||
BEGIN
|
||||
UPDATE PeakMotion SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE Record (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
creationInfo_agencyID VARCHAR,
|
||||
creationInfo_agencyURI VARCHAR,
|
||||
creationInfo_author VARCHAR,
|
||||
creationInfo_authorURI VARCHAR,
|
||||
creationInfo_creationTime DATETIME,
|
||||
creationInfo_creationTime_ms INTEGER,
|
||||
creationInfo_modificationTime DATETIME,
|
||||
creationInfo_modificationTime_ms INTEGER,
|
||||
creationInfo_version VARCHAR,
|
||||
creationInfo_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
gainUnit CHAR,
|
||||
duration DOUBLE,
|
||||
startTime_value DATETIME NOT NULL,
|
||||
startTime_value_ms INTEGER NOT NULL,
|
||||
startTime_uncertainty DOUBLE UNSIGNED,
|
||||
startTime_lowerUncertainty DOUBLE UNSIGNED,
|
||||
startTime_upperUncertainty DOUBLE UNSIGNED,
|
||||
startTime_confidenceLevel DOUBLE UNSIGNED,
|
||||
startTime_pdf_variable_content BLOB,
|
||||
startTime_pdf_probability_content BLOB,
|
||||
startTime_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
owner_name VARCHAR,
|
||||
owner_forename VARCHAR,
|
||||
owner_agency VARCHAR,
|
||||
owner_department VARCHAR,
|
||||
owner_address VARCHAR,
|
||||
owner_phone VARCHAR,
|
||||
owner_email VARCHAR,
|
||||
owner_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
resampleRateNumerator INT UNSIGNED,
|
||||
resampleRateDenominator INT UNSIGNED,
|
||||
waveformID_networkCode CHAR NOT NULL,
|
||||
waveformID_stationCode CHAR NOT NULL,
|
||||
waveformID_locationCode CHAR,
|
||||
waveformID_channelCode CHAR,
|
||||
waveformID_resourceURI VARCHAR,
|
||||
waveformFile_creationInfo_agencyID VARCHAR,
|
||||
waveformFile_creationInfo_agencyURI VARCHAR,
|
||||
waveformFile_creationInfo_author VARCHAR,
|
||||
waveformFile_creationInfo_authorURI VARCHAR,
|
||||
waveformFile_creationInfo_creationTime DATETIME,
|
||||
waveformFile_creationInfo_creationTime_ms INTEGER,
|
||||
waveformFile_creationInfo_modificationTime DATETIME,
|
||||
waveformFile_creationInfo_modificationTime_ms INTEGER,
|
||||
waveformFile_creationInfo_version VARCHAR,
|
||||
waveformFile_creationInfo_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
waveformFile_class VARCHAR,
|
||||
waveformFile_type VARCHAR,
|
||||
waveformFile_filename VARCHAR,
|
||||
waveformFile_url VARCHAR,
|
||||
waveformFile_description VARCHAR,
|
||||
waveformFile_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
CREATE TRIGGER RecordUpdate UPDATE ON Record
|
||||
BEGIN
|
||||
UPDATE Record SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE EventRecordReference (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
recordID VARCHAR NOT NULL,
|
||||
campbellDistance_value DOUBLE,
|
||||
campbellDistance_uncertainty DOUBLE UNSIGNED,
|
||||
campbellDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
campbellDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
campbellDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
campbellDistance_pdf_variable_content BLOB,
|
||||
campbellDistance_pdf_probability_content BLOB,
|
||||
campbellDistance_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
campbellDistance_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
ruptureToStationAzimuth_value DOUBLE,
|
||||
ruptureToStationAzimuth_uncertainty DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_lowerUncertainty DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_upperUncertainty DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_confidenceLevel DOUBLE UNSIGNED,
|
||||
ruptureToStationAzimuth_pdf_variable_content BLOB,
|
||||
ruptureToStationAzimuth_pdf_probability_content BLOB,
|
||||
ruptureToStationAzimuth_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
ruptureToStationAzimuth_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
ruptureAreaDistance_value DOUBLE,
|
||||
ruptureAreaDistance_uncertainty DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
ruptureAreaDistance_pdf_variable_content BLOB,
|
||||
ruptureAreaDistance_pdf_probability_content BLOB,
|
||||
ruptureAreaDistance_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
ruptureAreaDistance_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
JoynerBooreDistance_value DOUBLE,
|
||||
JoynerBooreDistance_uncertainty DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
JoynerBooreDistance_pdf_variable_content BLOB,
|
||||
JoynerBooreDistance_pdf_probability_content BLOB,
|
||||
JoynerBooreDistance_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
JoynerBooreDistance_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
closestFaultDistance_value DOUBLE,
|
||||
closestFaultDistance_uncertainty DOUBLE UNSIGNED,
|
||||
closestFaultDistance_lowerUncertainty DOUBLE UNSIGNED,
|
||||
closestFaultDistance_upperUncertainty DOUBLE UNSIGNED,
|
||||
closestFaultDistance_confidenceLevel DOUBLE UNSIGNED,
|
||||
closestFaultDistance_pdf_variable_content BLOB,
|
||||
closestFaultDistance_pdf_probability_content BLOB,
|
||||
closestFaultDistance_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
closestFaultDistance_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
preEventLength DOUBLE,
|
||||
postEventLength DOUBLE,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX EventRecordReference_recordID ON EventRecordReference(recordID);
|
||||
|
||||
CREATE TRIGGER EventRecordReferenceUpdate UPDATE ON EventRecordReference
|
||||
BEGIN
|
||||
UPDATE EventRecordReference SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE Rupture (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
width_value DOUBLE,
|
||||
width_uncertainty DOUBLE UNSIGNED,
|
||||
width_lowerUncertainty DOUBLE UNSIGNED,
|
||||
width_upperUncertainty DOUBLE UNSIGNED,
|
||||
width_confidenceLevel DOUBLE UNSIGNED,
|
||||
width_pdf_variable_content BLOB,
|
||||
width_pdf_probability_content BLOB,
|
||||
width_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
width_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
displacement_value DOUBLE,
|
||||
displacement_uncertainty DOUBLE UNSIGNED,
|
||||
displacement_lowerUncertainty DOUBLE UNSIGNED,
|
||||
displacement_upperUncertainty DOUBLE UNSIGNED,
|
||||
displacement_confidenceLevel DOUBLE UNSIGNED,
|
||||
displacement_pdf_variable_content BLOB,
|
||||
displacement_pdf_probability_content BLOB,
|
||||
displacement_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
displacement_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
riseTime_value DOUBLE,
|
||||
riseTime_uncertainty DOUBLE UNSIGNED,
|
||||
riseTime_lowerUncertainty DOUBLE UNSIGNED,
|
||||
riseTime_upperUncertainty DOUBLE UNSIGNED,
|
||||
riseTime_confidenceLevel DOUBLE UNSIGNED,
|
||||
riseTime_pdf_variable_content BLOB,
|
||||
riseTime_pdf_probability_content BLOB,
|
||||
riseTime_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
riseTime_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
vt_to_vs_value DOUBLE,
|
||||
vt_to_vs_uncertainty DOUBLE UNSIGNED,
|
||||
vt_to_vs_lowerUncertainty DOUBLE UNSIGNED,
|
||||
vt_to_vs_upperUncertainty DOUBLE UNSIGNED,
|
||||
vt_to_vs_confidenceLevel DOUBLE UNSIGNED,
|
||||
vt_to_vs_pdf_variable_content BLOB,
|
||||
vt_to_vs_pdf_probability_content BLOB,
|
||||
vt_to_vs_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
vt_to_vs_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
shallowAsperityDepth_value DOUBLE,
|
||||
shallowAsperityDepth_uncertainty DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_lowerUncertainty DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_upperUncertainty DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_confidenceLevel DOUBLE UNSIGNED,
|
||||
shallowAsperityDepth_pdf_variable_content BLOB,
|
||||
shallowAsperityDepth_pdf_probability_content BLOB,
|
||||
shallowAsperityDepth_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
shallowAsperityDepth_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
shallowAsperity INTEGER(1),
|
||||
literatureSource_title VARCHAR,
|
||||
literatureSource_firstAuthorName VARCHAR,
|
||||
literatureSource_firstAuthorForename VARCHAR,
|
||||
literatureSource_secondaryAuthors VARCHAR,
|
||||
literatureSource_doi VARCHAR,
|
||||
literatureSource_year INT UNSIGNED,
|
||||
literatureSource_in_title VARCHAR,
|
||||
literatureSource_editor VARCHAR,
|
||||
literatureSource_place VARCHAR,
|
||||
literatureSource_language VARCHAR,
|
||||
literatureSource_tome INT UNSIGNED,
|
||||
literatureSource_page_from INT UNSIGNED,
|
||||
literatureSource_page_to INT UNSIGNED,
|
||||
literatureSource_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
slipVelocity_value DOUBLE,
|
||||
slipVelocity_uncertainty DOUBLE UNSIGNED,
|
||||
slipVelocity_lowerUncertainty DOUBLE UNSIGNED,
|
||||
slipVelocity_upperUncertainty DOUBLE UNSIGNED,
|
||||
slipVelocity_confidenceLevel DOUBLE UNSIGNED,
|
||||
slipVelocity_pdf_variable_content BLOB,
|
||||
slipVelocity_pdf_probability_content BLOB,
|
||||
slipVelocity_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
slipVelocity_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
strike_value DOUBLE,
|
||||
strike_uncertainty DOUBLE UNSIGNED,
|
||||
strike_lowerUncertainty DOUBLE UNSIGNED,
|
||||
strike_upperUncertainty DOUBLE UNSIGNED,
|
||||
strike_confidenceLevel DOUBLE UNSIGNED,
|
||||
strike_pdf_variable_content BLOB,
|
||||
strike_pdf_probability_content BLOB,
|
||||
strike_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
strike_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
length_value DOUBLE,
|
||||
length_uncertainty DOUBLE UNSIGNED,
|
||||
length_lowerUncertainty DOUBLE UNSIGNED,
|
||||
length_upperUncertainty DOUBLE UNSIGNED,
|
||||
length_confidenceLevel DOUBLE UNSIGNED,
|
||||
length_pdf_variable_content BLOB,
|
||||
length_pdf_probability_content BLOB,
|
||||
length_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
length_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
area_value DOUBLE,
|
||||
area_uncertainty DOUBLE UNSIGNED,
|
||||
area_lowerUncertainty DOUBLE UNSIGNED,
|
||||
area_upperUncertainty DOUBLE UNSIGNED,
|
||||
area_confidenceLevel DOUBLE UNSIGNED,
|
||||
area_pdf_variable_content BLOB,
|
||||
area_pdf_probability_content BLOB,
|
||||
area_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
area_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
ruptureVelocity_value DOUBLE,
|
||||
ruptureVelocity_uncertainty DOUBLE UNSIGNED,
|
||||
ruptureVelocity_lowerUncertainty DOUBLE UNSIGNED,
|
||||
ruptureVelocity_upperUncertainty DOUBLE UNSIGNED,
|
||||
ruptureVelocity_confidenceLevel DOUBLE UNSIGNED,
|
||||
ruptureVelocity_pdf_variable_content BLOB,
|
||||
ruptureVelocity_pdf_probability_content BLOB,
|
||||
ruptureVelocity_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
ruptureVelocity_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
stressdrop_value DOUBLE,
|
||||
stressdrop_uncertainty DOUBLE UNSIGNED,
|
||||
stressdrop_lowerUncertainty DOUBLE UNSIGNED,
|
||||
stressdrop_upperUncertainty DOUBLE UNSIGNED,
|
||||
stressdrop_confidenceLevel DOUBLE UNSIGNED,
|
||||
stressdrop_pdf_variable_content BLOB,
|
||||
stressdrop_pdf_probability_content BLOB,
|
||||
stressdrop_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
stressdrop_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
momentReleaseTop5km_value DOUBLE,
|
||||
momentReleaseTop5km_uncertainty DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_lowerUncertainty DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_upperUncertainty DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_confidenceLevel DOUBLE UNSIGNED,
|
||||
momentReleaseTop5km_pdf_variable_content BLOB,
|
||||
momentReleaseTop5km_pdf_probability_content BLOB,
|
||||
momentReleaseTop5km_pdf_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
momentReleaseTop5km_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
fwHwIndicator VARCHAR(64),
|
||||
ruptureGeometryWKT VARCHAR,
|
||||
faultID VARCHAR NOT NULL,
|
||||
surfaceRupture_observed INTEGER(1),
|
||||
surfaceRupture_evidence VARCHAR,
|
||||
surfaceRupture_literatureSource_title VARCHAR,
|
||||
surfaceRupture_literatureSource_firstAuthorName VARCHAR,
|
||||
surfaceRupture_literatureSource_firstAuthorForename VARCHAR,
|
||||
surfaceRupture_literatureSource_secondaryAuthors VARCHAR,
|
||||
surfaceRupture_literatureSource_doi VARCHAR,
|
||||
surfaceRupture_literatureSource_year INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_in_title VARCHAR,
|
||||
surfaceRupture_literatureSource_editor VARCHAR,
|
||||
surfaceRupture_literatureSource_place VARCHAR,
|
||||
surfaceRupture_literatureSource_language VARCHAR,
|
||||
surfaceRupture_literatureSource_tome INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_page_from INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_page_to INT UNSIGNED,
|
||||
surfaceRupture_literatureSource_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
surfaceRupture_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
centroidReference VARCHAR,
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX Rupture_ruptureGeometryWKT ON Rupture(ruptureGeometryWKT);
|
||||
|
||||
CREATE TRIGGER RuptureUpdate UPDATE ON Rupture
|
||||
BEGIN
|
||||
UPDATE Rupture SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
||||
|
||||
CREATE TABLE StrongOriginDescription (
|
||||
_oid INTEGER NOT NULL,
|
||||
_parent_oid INTEGER NOT NULL,
|
||||
_last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
originID VARCHAR NOT NULL,
|
||||
waveformCount INT UNSIGNED,
|
||||
creationInfo_agencyID VARCHAR,
|
||||
creationInfo_agencyURI VARCHAR,
|
||||
creationInfo_author VARCHAR,
|
||||
creationInfo_authorURI VARCHAR,
|
||||
creationInfo_creationTime DATETIME,
|
||||
creationInfo_creationTime_ms INTEGER,
|
||||
creationInfo_modificationTime DATETIME,
|
||||
creationInfo_modificationTime_ms INTEGER,
|
||||
creationInfo_version VARCHAR,
|
||||
creationInfo_used INTEGER(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY(_oid),
|
||||
FOREIGN KEY(_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY(_parent_oid)
|
||||
REFERENCES Object(_oid)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX StrongOriginDescription_originID ON StrongOriginDescription(originID);
|
||||
|
||||
CREATE TRIGGER StrongOriginDescriptionUpdate UPDATE ON StrongOriginDescription
|
||||
BEGIN
|
||||
UPDATE StrongOriginDescription SET _last_modified=CURRENT_TIMESTAMP WHERE _oid=old._oid;
|
||||
END;
|
Reference in New Issue
Block a user