Project

General

Profile

« Previous | Next » 

Revision 11074

schemas/vegbien.sql: link locationevent to stratum instead of the other way around (similar to how it's represented in normalized VegCore as stratum_event->stratum, rather than stratum->taxa_sampling_event). this works around column-based import's lack of support for linking two tables together via two separate routes (in this case locationevent->taxonoccurrence->stratum and locationevent->stratum).

View differences:

schemas/vegbien.my.sql
1037 1037
    parent_id int(11),
1038 1038
    location_id int(11),
1039 1039
    project_id int(11),
1040
    stratum_id int(11),
1040 1041
    authoreventcode varchar(255),
1041 1042
    previous_id int(11),
1042 1043
    obsstartdate date,
......
3048 3049

  
3049 3050
CREATE TABLE stratum (
3050 3051
    stratum_id int(11) NOT NULL,
3051
    locationevent_id int(11) NOT NULL,
3052 3052
    stratumname varchar(255),
3053 3053
    stratumheight double precision,
3054 3054
    stratumbase double precision,
......
5326 5326

  
5327 5327

  
5328 5328
--
5329
-- Name: locationevent__stratum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5330
--
5331

  
5332
CREATE INDEX locationevent__stratum_id ON locationevent  (stratum_id);
5333

  
5334

  
5335
--
5329 5336
-- Name: locationevent_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5330 5337
--
5331 5338

  
......
5837 5844

  
5838 5845

  
5839 5846
--
5840
-- Name: stratum_locationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5841
--
5842

  
5843
CREATE INDEX stratum_locationevent_id_idx ON stratum  (locationevent_id);
5844

  
5845

  
5846
--
5847 5847
-- Name: stratum_method_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5848 5848
--
5849 5849

  
......
6556 6556

  
6557 6557

  
6558 6558
--
6559
-- Name: locationevent_stratum_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
6560
--
6561

  
6562
ALTER TABLE locationevent
6563
    ADD CONSTRAINT locationevent_stratum_id_fkey FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;
6564

  
6565

  
6566
--
6559 6567
-- Name: locationeventcontributor_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
6560 6568
--
6561 6569

  
......
6954 6962

  
6955 6963

  
6956 6964
--
6957
-- Name: stratum_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
6958
--
6959

  
6960
ALTER TABLE stratum
6961
    ADD CONSTRAINT stratum_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
6962

  
6963

  
6964
--
6965 6965
-- Name: stratum_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
6966 6966
--
6967 6967

  
schemas/vegbien.sql
1977 1977
    parent_id integer,
1978 1978
    location_id integer,
1979 1979
    project_id integer,
1980
    stratum_id integer,
1980 1981
    authoreventcode text,
1981 1982
    previous_id integer,
1982 1983
    obsstartdate date,
......
4247 4248

  
4248 4249
CREATE TABLE stratum (
4249 4250
    stratum_id integer NOT NULL,
4250
    locationevent_id integer NOT NULL,
4251 4251
    stratumname text,
4252 4252
    stratumheight double precision,
4253 4253
    stratumbase double precision,
......
6601 6601

  
6602 6602

  
6603 6603
--
6604
-- Name: locationevent__stratum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6605
--
6606

  
6607
CREATE INDEX locationevent__stratum_id ON locationevent USING btree (stratum_id);
6608

  
6609

  
6610
--
6604 6611
-- Name: locationevent_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6605 6612
--
6606 6613

  
......
7112 7119

  
7113 7120

  
7114 7121
--
7115
-- Name: stratum_locationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
7116
--
7117

  
7118
CREATE INDEX stratum_locationevent_id_idx ON stratum USING btree (locationevent_id);
7119

  
7120

  
7121
--
7122 7122
-- Name: stratum_method_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
7123 7123
--
7124 7124

  
......
7850 7850

  
7851 7851

  
7852 7852
--
7853
-- Name: locationevent_stratum_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
7854
--
7855

  
7856
ALTER TABLE ONLY locationevent
7857
    ADD CONSTRAINT locationevent_stratum_id_fkey FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;
7858

  
7859

  
7860
--
7853 7861
-- Name: locationeventcontributor_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
7854 7862
--
7855 7863

  
......
8266 8274

  
8267 8275

  
8268 8276
--
8269
-- Name: stratum_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
8270
--
8271

  
8272
ALTER TABLE ONLY stratum
8273
    ADD CONSTRAINT stratum_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
8274

  
8275

  
8276
--
8277 8277
-- Name: stratum_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
8278 8278
--
8279 8279

  

Also available in: Unified diff