Project

General

Profile

« Previous | Next » 

Revision 6417

schemas/vegbien.sql: analytical_aggregate: Added primary key on institutionCode, plotName, scientificNameWithMorphospecies, recordNumber. Note that this makes these fields NOT NULL, which should not be a problem because there are inner joins instead of LEFT JOINs on most of the tables which provide them, and LEFT JOINed tables have their identifying fields combined to create a NOT NULL value.

View differences:

schemas/vegbien.my.sql
707 707
--
708 708

  
709 709
CREATE TABLE analytical_stem (
710
    `institutionCode` text,
710
    `institutionCode` text NOT NULL,
711 711
    country text,
712 712
    `stateProvince` text,
713 713
    county text,
......
718 718
    `isNewWorld` int(1),
719 719
    `distanceToCountry_km` double precision,
720 720
    `distanceToStateProvince_km` double precision,
721
    `plotName` text,
721
    `plotName` text NOT NULL,
722 722
    `elevationInMeters` double precision,
723 723
    `plotArea_ha` double precision,
724 724
    `samplingProtocol` text,
......
729 729
    `speciesBinomial` text,
730 730
    `scientificName` text,
731 731
    `scientificNameAuthorship` text,
732
    `scientificNameWithMorphospecies` text,
732
    `scientificNameWithMorphospecies` text NOT NULL,
733 733
    threatened int(1),
734 734
    `identifiedBy` text,
735 735
    `growthForm` text,
......
742 742
    `organismX_m` double precision,
743 743
    `organismY_m` double precision,
744 744
    `recordedBy` text,
745
    `recordNumber` text
745
    `recordNumber` text NOT NULL
746 746
);
747 747

  
748 748

  
......
4175 4175

  
4176 4176

  
4177 4177
--
4178
-- Name: analytical_stem_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4179
--
4180

  
4181
ALTER TABLE analytical_stem
4182
    ADD CONSTRAINT analytical_stem_pkey PRIMARY KEY (`institutionCode`, `plotName`, `scientificNameWithMorphospecies`, `recordNumber`);
4183

  
4184

  
4185
--
4178 4186
-- Name: classcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4179 4187
--
4180 4188

  
schemas/vegbien.sql
1375 1375
--
1376 1376

  
1377 1377
CREATE TABLE analytical_stem (
1378
    "institutionCode" text,
1378
    "institutionCode" text NOT NULL,
1379 1379
    country text,
1380 1380
    "stateProvince" text,
1381 1381
    county text,
......
1386 1386
    "isNewWorld" boolean,
1387 1387
    "distanceToCountry_km" double precision,
1388 1388
    "distanceToStateProvince_km" double precision,
1389
    "plotName" text,
1389
    "plotName" text NOT NULL,
1390 1390
    "elevationInMeters" double precision,
1391 1391
    "plotArea_ha" double precision,
1392 1392
    "samplingProtocol" text,
......
1397 1397
    "speciesBinomial" text,
1398 1398
    "scientificName" text,
1399 1399
    "scientificNameAuthorship" text,
1400
    "scientificNameWithMorphospecies" text,
1400
    "scientificNameWithMorphospecies" text NOT NULL,
1401 1401
    threatened boolean,
1402 1402
    "identifiedBy" text,
1403 1403
    "growthForm" growthform,
......
1410 1410
    "organismX_m" double precision,
1411 1411
    "organismY_m" double precision,
1412 1412
    "recordedBy" text,
1413
    "recordNumber" text
1413
    "recordNumber" text NOT NULL
1414 1414
);
1415 1415

  
1416 1416

  
......
5172 5172

  
5173 5173

  
5174 5174
--
5175
-- Name: analytical_stem_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
5176
--
5177

  
5178
ALTER TABLE ONLY analytical_stem
5179
    ADD CONSTRAINT analytical_stem_pkey PRIMARY KEY ("institutionCode", "plotName", "scientificNameWithMorphospecies", "recordNumber");
5180

  
5181

  
5182
--
5175 5183
-- Name: classcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
5176 5184
--
5177 5185

  

Also available in: Unified diff