--
--ER/Studio 6.5 SQL Code Generation
-- Company :      Berkeley Seismological Laboratory
-- Project :      NCEDC/TriNet Parametric Information
-- Author :       Stephane Zuzlewski
--
-- Date Created : Thursday, July 22, 2004 10:31:05
-- Target DBMS : Oracle 9i
--

DROP TABLE amp CASCADE CONSTRAINTS
;
DROP TABLE arrival CASCADE CONSTRAINTS
;
DROP TABLE assocamm CASCADE CONSTRAINTS
;
DROP TABLE assocamo CASCADE CONSTRAINTS
;
DROP TABLE assocaro CASCADE CONSTRAINTS
;
DROP TABLE assoccom CASCADE CONSTRAINTS
;
DROP TABLE assoccoo CASCADE CONSTRAINTS
;
DROP TABLE coda CASCADE CONSTRAINTS
;
DROP TABLE event CASCADE CONSTRAINTS
;
DROP TABLE mec CASCADE CONSTRAINTS
;
DROP TABLE netmag CASCADE CONSTRAINTS
;
DROP TABLE origin CASCADE CONSTRAINTS
;
DROP TABLE origin_error CASCADE CONSTRAINTS
;
DROP TABLE remark CASCADE CONSTRAINTS
;
DROP TABLE significant_event CASCADE CONSTRAINTS
;
DROP TABLE stacorrections CASCADE CONSTRAINTS
;
-- 
-- SEQUENCE: NCEDCDBA.AMPSEQ 
--

DROP SEQUENCE NCEDCDBA.AMPSEQ
;

CREATE SEQUENCE NCEDCDBA.AMPSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.ARSEQ 
--

DROP SEQUENCE NCEDCDBA.ARSEQ
;

CREATE SEQUENCE NCEDCDBA.ARSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.COMMSEQ 
--

DROP SEQUENCE NCEDCDBA.COMMSEQ
;

CREATE SEQUENCE NCEDCDBA.COMMSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.COSEQ 
--

DROP SEQUENCE NCEDCDBA.COSEQ
;

CREATE SEQUENCE NCEDCDBA.COSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.EVSEQ 
--

DROP SEQUENCE NCEDCDBA.EVSEQ
;

CREATE SEQUENCE NCEDCDBA.EVSEQ 
    START WITH 60000000
    INCREMENT BY 1
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.MAGSEQ 
--

DROP SEQUENCE NCEDCDBA.MAGSEQ
;

CREATE SEQUENCE NCEDCDBA.MAGSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.MECSEQ 
--

DROP SEQUENCE NCEDCDBA.MECSEQ
;

CREATE SEQUENCE NCEDCDBA.MECSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- SEQUENCE: NCEDCDBA.ORSEQ 
--

DROP SEQUENCE NCEDCDBA.ORSEQ
;

CREATE SEQUENCE NCEDCDBA.ORSEQ 
    START WITH 2
    INCREMENT BY 5
    NOMINVALUE
    NOMAXVALUE
    NOCYCLE
    CACHE 20
    ORDER
;

-- 
-- TABLE: amp 
--

CREATE TABLE amp(
    commid        NUMBER(15, 0),
    ampid         NUMBER(15, 0)       NOT NULL,
    datetime      NUMBER(25, 10)      NOT NULL,
    sta           VARCHAR2(6)         NOT NULL,
    net           VARCHAR2(8),
    auth          VARCHAR2(15)        NOT NULL,
    subsource     VARCHAR2(8),
    channel       VARCHAR2(3),
    channelsrc    VARCHAR2(8),
    seedchan      VARCHAR2(3),
    location      VARCHAR2(2),
    iphase        VARCHAR2(8),
    amplitude     DOUBLE PRECISION    NOT NULL,
    amptype       VARCHAR2(8),
    units         VARCHAR2(4)         NOT NULL,
    ampmeas       VARCHAR2(1),
    eramp         NUMBER(5, 3),
    flagamp       VARCHAR2(4),
    per           NUMBER(10, 4),
    snr           DOUBLE PRECISION,
    tau           NUMBER(7, 4),
    quality       NUMBER(2, 1),
    rflag         VARCHAR2(2),
    cflag         VARCHAR2(2),
    wstart        DOUBLE PRECISION,
    duration      DOUBLE PRECISION,
    lddate        DATE                 DEFAULT (SYSDATE),
    CONSTRAINT ampkey01 PRIMARY KEY (ampid)
)
;



-- 
-- TABLE: arrival 
--

CREATE TABLE arrival(
    arid          NUMBER(15, 0)       NOT NULL,
    commid        NUMBER(15, 0),
    datetime      NUMBER(25, 10)      NOT NULL,
    sta           VARCHAR2(6)         NOT NULL,
    net           VARCHAR2(8),
    auth          VARCHAR2(15)        NOT NULL,
    subsource     VARCHAR2(8),
    channel       VARCHAR2(3),
    channelsrc    VARCHAR2(8),
    seedchan      VARCHAR2(3),
    location      VARCHAR2(2),
    iphase        VARCHAR2(8),
    qual          VARCHAR2(1),
    clockqual     VARCHAR2(1),
    clockcorr     NUMBER(15, 0),
    ccset         VARCHAR2(1),
    fm            VARCHAR2(2),
    ema           NUMBER(5, 2),
    azimuth       NUMBER(4, 1),
    slow          NUMBER(8, 4),
    deltim        NUMBER(5, 2),
    delinc        NUMBER(4, 2),
    delaz         NUMBER(5, 2),
    delslo        NUMBER(8, 4),
    quality       NUMBER(2, 1),
    snr           DOUBLE PRECISION,
    rflag         VARCHAR2(2),
    lddate        DATE                 DEFAULT (SYSDATE),
    CONSTRAINT arkey01 PRIMARY KEY (arid)
)
;



-- 
-- TABLE: assocamm 
--

CREATE TABLE assocamm(
    magid         NUMBER(15, 0)    NOT NULL,
    ampid         NUMBER(15, 0)    NOT NULL,
    commid        NUMBER(15, 0),
    auth          VARCHAR2(15)     NOT NULL,
    subsource     VARCHAR2(8),
    weight        NUMBER(4, 3),
    in_wgt        NUMBER(4, 3),
    mag           NUMBER(5, 2),
    magres        NUMBER(5, 2),
    magcorr       NUMBER(5, 2),
    importance    NUMBER(2, 1),
    rflag         VARCHAR2(2),
    lddate        DATE              DEFAULT (SYSDATE),
    CONSTRAINT assocammkey01 PRIMARY KEY (magid, ampid)
)
;



-- 
-- TABLE: assocamo 
--

CREATE TABLE assocamo(
    orid         NUMBER(15, 0)    NOT NULL,
    ampid        NUMBER(15, 0)    NOT NULL,
    commid       NUMBER(15, 0),
    auth         VARCHAR2(15)     NOT NULL,
    subsource    VARCHAR2(8),
    delta        NUMBER(5, 1),
    seaz         NUMBER(4, 1),
    rflag        VARCHAR2(2),
    lddate       DATE              DEFAULT (SYSDATE),
    CONSTRAINT assocamokey01 PRIMARY KEY (orid, ampid)
)
;



-- 
-- TABLE: assocaro 
--

CREATE TABLE assocaro(
    orid          NUMBER(15, 0)    NOT NULL,
    arid          NUMBER(15, 0)    NOT NULL,
    commid        NUMBER(15, 0),
    auth          VARCHAR2(15)     NOT NULL,
    subsource     VARCHAR2(8),
    iphase        VARCHAR2(8),
    importance    NUMBER(2, 1),
    delta         NUMBER(5, 1),
    seaz          NUMBER(4, 1),
    in_wgt        NUMBER(4, 3),
    wgt           NUMBER(4, 3),
    timeres       NUMBER(5, 2),
    azres         NUMBER(5, 3),
    emares        NUMBER(5, 3),
    slores        NUMBER(8, 4),
    vmodelid      NUMBER(3, 0),
    scorr         NUMBER(6, 4),
    sdelay        NUMBER(7, 4),
    rflag         VARCHAR2(2),
    ccset         VARCHAR2(1),
    lddate        DATE              DEFAULT (SYSDATE),
    CONSTRAINT assocarokey01 PRIMARY KEY (orid, arid)
)
;



-- 
-- TABLE: assoccom 
--

CREATE TABLE assoccom(
    magid        NUMBER(15, 0)    NOT NULL,
    coid         NUMBER(15, 0)    NOT NULL,
    commid       NUMBER(15, 0),
    auth         VARCHAR2(15)     NOT NULL,
    subsource    VARCHAR2(8),
    weight       NUMBER(4, 3),
    in_wgt       NUMBER(4, 3),
    mag          NUMBER(7, 4),
    magres       NUMBER(7, 4),
    magcorr      NUMBER(7, 4),
    rflag        VARCHAR2(2),
    lddate       DATE              DEFAULT (SYSDATE),
    CONSTRAINT assoccomkey01 PRIMARY KEY (magid, coid)
)
;



-- 
-- TABLE: assoccoo 
--

CREATE TABLE assoccoo(
    orid         NUMBER(15, 0)    NOT NULL,
    coid         NUMBER(15, 0)    NOT NULL,
    commid       NUMBER(15, 0),
    auth         VARCHAR2(15)     NOT NULL,
    subsource    VARCHAR2(8),
    delta        NUMBER(7, 4),
    seaz         NUMBER(7, 4),
    rflag        VARCHAR2(2),
    lddate       DATE              DEFAULT (SYSDATE),
    CONSTRAINT assoccookey01 PRIMARY KEY (orid, coid)
)
;



-- 
-- TABLE: coda 
--

CREATE TABLE coda(
    coid          NUMBER(15, 0)     NOT NULL,
    commid        NUMBER(15, 0),
    sta           VARCHAR2(6)       NOT NULL,
    net           VARCHAR2(8),
    auth          VARCHAR2(15)      NOT NULL,
    subsource     VARCHAR2(8),
    channel       VARCHAR2(3),
    channelsrc    VARCHAR2(8),
    seedchan      VARCHAR2(3),
    location      VARCHAR2(2),
    codatype      VARCHAR2(3),
    afix          NUMBER(7, 4),
    afree         NUMBER(7, 4),
    qfix          NUMBER(7, 4),
    qfree         NUMBER(7, 4),
    tau           NUMBER(7, 4),
    nsample       NUMBER(6, 0),
    rms           NUMBER(5, 3),
    durtype       VARCHAR2(3),
    iphase        VARCHAR2(8),
    eramp         NUMBER(5, 3),
    units         VARCHAR2(4)       NOT NULL,
    time1         NUMBER(10, 0),
    amp1          NUMBER(10, 0),
    time2         NUMBER(10, 0),
    amp2          NUMBER(10, 0),
    time3         NUMBER(10, 0),
    amp3          NUMBER(10, 0),
    time4         NUMBER(10, 0),
    amp4          NUMBER(10, 0),
    time5         NUMBER(10, 0),
    amp5          NUMBER(10, 0),
    time6         NUMBER(10, 0),
    amp6          NUMBER(10, 0),
    quality       NUMBER(2, 1),
    datetime      NUMBER(25, 10),
    algorithm     VARCHAR2(16),
    winsize       NUMBER(7, 4),
    rflag         VARCHAR2(2),
    lddate        DATE               DEFAULT (SYSDATE),
    CONSTRAINT codakey01 PRIMARY KEY (coid)
)
;



-- 
-- TABLE: event 
--

CREATE TABLE event(
    evid          NUMBER(15, 0)    NOT NULL,
    prefor        NUMBER(15, 0),
    prefmag       NUMBER(15, 0),
    prefmec       NUMBER(15, 0),
    commid        NUMBER(15, 0),
    auth          VARCHAR2(15)     NOT NULL,
    subsource     VARCHAR2(8),
    etype         VARCHAR2(7),
    selectflag    NUMBER(1, 0),
    version       NUMBER(3, 0),
    lddate        DATE              DEFAULT (SYSDATE),
    CONSTRAINT evkey01 PRIMARY KEY (evid)
)
;



-- 
-- TABLE: mec 
--

CREATE TABLE mec(
    mecid          NUMBER(15, 0)       NOT NULL,
    oridin         NUMBER(15, 0),
    oridout        NUMBER(15, 0),
    magid          NUMBER(15, 0),
    commid         NUMBER(15, 0),
    mechtype       VARCHAR2(2),
    mecalgo        VARCHAR2(15),
    scalar         DOUBLE PRECISION,
    erscalar       DOUBLE PRECISION,
    tft            VARCHAR2(8),
    tfd            DOUBLE PRECISION,
    mxx            DOUBLE PRECISION,
    myy            DOUBLE PRECISION,
    mzz            DOUBLE PRECISION,
    mxy            DOUBLE PRECISION,
    mxz            DOUBLE PRECISION,
    myz            DOUBLE PRECISION,
    smxx           DOUBLE PRECISION,
    smyy           DOUBLE PRECISION,
    smzz           DOUBLE PRECISION,
    smxy           DOUBLE PRECISION,
    smxz           DOUBLE PRECISION,
    smyz           DOUBLE PRECISION,
    srcduration    NUMBER(6, 3),
    auth           VARCHAR2(15)        NOT NULL,
    subsource      VARCHAR2(8),
    strike1        NUMBER(3, 0),
    dip1           NUMBER(3, 0),
    rake1          NUMBER(4, 0),
    strike2        NUMBER(3, 0),
    dip2           NUMBER(2, 0),
    rake2          NUMBER(4, 0),
    unstrike1      NUMBER(6, 3),
    undip1         NUMBER(5, 3),
    unrake1        NUMBER(6, 3),
    unstrike2      NUMBER(6, 3),
    undip2         NUMBER(5, 3),
    unrake2        NUMBER(6, 3),
    eigenp         NUMBER(7, 5),
    plungep        NUMBER(2, 0),
    strikep        NUMBER(3, 0),
    eigenn         NUMBER(7, 5),
    plungen        NUMBER(2, 0),
    striken        NUMBER(3, 0),
    eigent         NUMBER(7, 5),
    plunget        NUMBER(2, 0),
    striket        NUMBER(3, 0),
    nsta           NUMBER(5, 0),
    pvr            NUMBER(5, 0),
    quality        NUMBER(2, 1),
    pdc            NUMBER(3, 0),
    pclvd          NUMBER(3, 0),
    piso           NUMBER(3, 0),
    datetime       NUMBER(25, 10)      NOT NULL,
    rflag          VARCHAR2(2),
    lddate         DATE                 DEFAULT (SYSDATE),
    CONSTRAINT meckey01 PRIMARY KEY (mecid)
)
;



-- 
-- TABLE: netmag 
--

CREATE TABLE netmag(
    magid          NUMBER(15, 0)    NOT NULL,
    orid           NUMBER(15, 0)    NOT NULL,
    commid         NUMBER(15, 0),
    magnitude      NUMBER(5, 2)     NOT NULL,
    magtype        VARCHAR2(6)      NOT NULL,
    auth           VARCHAR2(15)     NOT NULL,
    subsource      VARCHAR2(8),
    magalgo        VARCHAR2(15),
    nsta           NUMBER(5, 0),
    uncertainty    NUMBER(5, 3),
    gap            NUMBER(4, 1),
    distance       NUMBER(7, 3),
    quality        NUMBER(2, 1),
    rflag          VARCHAR2(2),
    lddate         DATE              DEFAULT (SYSDATE),
    CONSTRAINT magkey01 PRIMARY KEY (magid)
)
;



-- 
-- TABLE: origin 
--

CREATE TABLE origin(
    orid          NUMBER(15, 0)     NOT NULL,
    evid          NUMBER(15, 0)     NOT NULL,
    prefmag       NUMBER(15, 0),
    prefmec       NUMBER(15, 0),
    commid        NUMBER(15, 0),
    bogusflag     NUMBER(1, 0),
    datetime      NUMBER(25, 10)    NOT NULL,
    lat           NUMBER(9, 7)      NOT NULL,
    lon           NUMBER(10, 7)     NOT NULL,
    depth         NUMBER(7, 3),
    type          VARCHAR2(2),
    algorithm     VARCHAR2(15),
    algo_assoc    VARCHAR2(80),
    auth          VARCHAR2(15)      NOT NULL,
    subsource     VARCHAR2(8),
    datumhor      VARCHAR2(8),
    datumver      VARCHAR2(8),
    gap           NUMBER(4, 1),
    distance      NUMBER(7, 3),
    wrms          NUMBER(5, 3),
    stime         NUMBER(6, 3),
    erhor         NUMBER(7, 3),
    sdep          NUMBER(7, 3),
    erlat         NUMBER(7, 3),
    erlon         NUMBER(7, 3),
    totalarr      NUMBER(5, 0),
    totalamp      NUMBER(6, 0),
    ndef          NUMBER(5, 0),
    nbs           NUMBER(4, 0),
    nbfm          NUMBER(4, 0),
    locevid       VARCHAR2(12),
    quality       NUMBER(2, 1),
    fdepth        VARCHAR2(1),
    fepi          VARCHAR2(1),
    ftime         VARCHAR2(1),
    vmodelid      NUMBER(3, 0),
    cmodelid      NUMBER(3, 0),
    rflag         VARCHAR2(2),
    lddate        DATE               DEFAULT (SYSDATE),
    CONSTRAINT orkey01 PRIMARY KEY (orid)
)
;



-- 
-- TABLE: origin_error 
--

CREATE TABLE origin_error(
    orid        NUMBER(15, 0)    NOT NULL,
    sxx         NUMBER(7, 3),
    syy         NUMBER(7, 3),
    szz         NUMBER(7, 3),
    stt         NUMBER(7, 3),
    sxy         NUMBER(7, 3),
    sxz         NUMBER(7, 3),
    syz         NUMBER(7, 3),
    stx         NUMBER(7, 3),
    sty         NUMBER(7, 3),
    stz         NUMBER(7, 3),
    azismall    NUMBER(5, 2),
    dipsmall    NUMBER(4, 2),
    magsmall    NUMBER(7, 5),
    aziinter    NUMBER(5, 2),
    dipinter    NUMBER(4, 2),
    maginter    NUMBER(7, 5),
    azilarge    NUMBER(5, 2),
    diplarge    NUMBER(4, 2),
    maglarge    NUMBER(7, 5),
    lddate      DATE              DEFAULT (SYSDATE),
    CONSTRAINT orerrkey01 PRIMARY KEY (orid)
)
;



-- 
-- TABLE: remark 
--

CREATE TABLE remark(
    commid    NUMBER(15, 0)    NOT NULL,
    lineno    NUMBER(15, 0)    NOT NULL,
    remark    VARCHAR2(80),
    lddate    DATE              DEFAULT (SYSDATE),
    CONSTRAINT remkey01 PRIMARY KEY (commid, lineno)
)
;



-- 
-- TABLE: significant_event 
--

CREATE TABLE significant_event(
    evid       NUMBER(15, 0)    NOT NULL,
    evname     VARCHAR2(80),
    remarks    VARCHAR2(2),
    nfelt      NUMBER(8, 0),
    mmi        NUMBER(2, 0),
    pga        NUMBER(6, 4),
    lddate     DATE              DEFAULT (SYSDATE),
    CONSTRAINT sigevkey01 PRIMARY KEY (evid)
)
;



-- 
-- TABLE: stacorrections 
--

CREATE TABLE stacorrections(
    net           VARCHAR2(8)         NOT NULL,
    sta           VARCHAR2(6)         NOT NULL,
    seedchan      VARCHAR2(3)         NOT NULL,
    channel       VARCHAR2(3),
    channelsrc    VARCHAR2(8),
    location      VARCHAR2(2)         NOT NULL,
    auth          VARCHAR2(15),
    corr          DOUBLE PRECISION,
    corr_flag     VARCHAR2(1),
    corr_type     VARCHAR2(3),
    ondate        DATE                NOT NULL,
    offdate       DATE,
    lddate        DATE                 DEFAULT (SYSDATE),
    CONSTRAINT stacorrectionskey01 PRIMARY KEY (net, sta, seedchan, location, ondate)
)
;



-- 
-- TABLE: assocamm 
--

ALTER TABLE assocamm ADD CONSTRAINT Aam_Amp 
    FOREIGN KEY (ampid)
    REFERENCES amp(ampid)
;

ALTER TABLE assocamm ADD CONSTRAINT Aam_Net 
    FOREIGN KEY (magid)
    REFERENCES netmag(magid)
;


-- 
-- TABLE: assocamo 
--

ALTER TABLE assocamo ADD CONSTRAINT Amo_Amp 
    FOREIGN KEY (ampid)
    REFERENCES amp(ampid)
;

ALTER TABLE assocamo ADD CONSTRAINT Amo_Ori 
    FOREIGN KEY (orid)
    REFERENCES origin(orid)
;


-- 
-- TABLE: assocaro 
--

ALTER TABLE assocaro ADD CONSTRAINT Aao_Arr 
    FOREIGN KEY (arid)
    REFERENCES arrival(arid)
;

ALTER TABLE assocaro ADD CONSTRAINT Aao_Ori 
    FOREIGN KEY (orid)
    REFERENCES origin(orid)
;


-- 
-- TABLE: assoccom 
--

ALTER TABLE assoccom ADD CONSTRAINT Aom_Cod 
    FOREIGN KEY (coid)
    REFERENCES coda(coid)
;

ALTER TABLE assoccom ADD CONSTRAINT Aom_Net 
    FOREIGN KEY (magid)
    REFERENCES netmag(magid)
;


-- 
-- TABLE: assoccoo 
--

ALTER TABLE assoccoo ADD CONSTRAINT Aco_Cod 
    FOREIGN KEY (coid)
    REFERENCES coda(coid)
;

ALTER TABLE assoccoo ADD CONSTRAINT Aco_Ori 
    FOREIGN KEY (orid)
    REFERENCES origin(orid)
;


-- 
-- TABLE: event 
--

ALTER TABLE event ADD CONSTRAINT Eve_Mec 
    FOREIGN KEY (prefmec)
    REFERENCES mec(mecid)
;

ALTER TABLE event ADD CONSTRAINT Eve_Net 
    FOREIGN KEY (prefmag)
    REFERENCES netmag(magid)
;

ALTER TABLE event ADD CONSTRAINT Eve_Ori 
    FOREIGN KEY (prefor)
    REFERENCES origin(orid)
;


-- 
-- TABLE: mec 
--

ALTER TABLE mec ADD CONSTRAINT Mec_Net 
    FOREIGN KEY (magid)
    REFERENCES netmag(magid)
;

ALTER TABLE mec ADD CONSTRAINT Mec_Ori 
    FOREIGN KEY (oridin)
    REFERENCES origin(orid)
;

ALTER TABLE mec ADD CONSTRAINT Mec_Ori2 
    FOREIGN KEY (oridout)
    REFERENCES origin(orid)
;


-- 
-- TABLE: netmag 
--

ALTER TABLE netmag ADD CONSTRAINT Net_Ori 
    FOREIGN KEY (orid)
    REFERENCES origin(orid)
;


-- 
-- TABLE: origin 
--

ALTER TABLE origin ADD CONSTRAINT Ori_Eve 
    FOREIGN KEY (evid)
    REFERENCES event(evid)
;

ALTER TABLE origin ADD CONSTRAINT Ori_Mec 
    FOREIGN KEY (prefmec)
    REFERENCES mec(mecid)
;

ALTER TABLE origin ADD CONSTRAINT Ori_Net 
    FOREIGN KEY (prefmag)
    REFERENCES netmag(magid)
;


-- 
-- TABLE: origin_error 
--

ALTER TABLE origin_error ADD CONSTRAINT Ori__Err_Ori 
    FOREIGN KEY (orid)
    REFERENCES origin(orid)
;


-- 
-- TABLE: significant_event 
--

ALTER TABLE significant_event ADD CONSTRAINT Sig_Eve_Eve 
    FOREIGN KEY (evid)
    REFERENCES event(evid)
;


