Project

General

Profile

« Previous | Next » 

Revision 1113

vegbien.sql: Renamed _keys unique constraints/unique indexes to _unique to better reflect their purpose

View differences:

schemas/vegbien.my.sql
2880 2880

  
2881 2881

  
2882 2882
--
2883
-- Name: aggregateoccurrence_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2883
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2884 2884
--
2885 2885

  
2886 2886
ALTER TABLE aggregateoccurrence
2887
    ADD CONSTRAINT aggregateoccurrence_keys_accessioncode UNIQUE (taxonoccurrence_id, sourceaccessioncode);
2887
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);
2888 2888

  
2889 2889

  
2890 2890
--
2891
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2891
-- Name: aggregateoccurrence_unique_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2892 2892
--
2893 2893

  
2894 2894
ALTER TABLE aggregateoccurrence
2895
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);
2895
    ADD CONSTRAINT aggregateoccurrence_unique_accessioncode UNIQUE (taxonoccurrence_id, sourceaccessioncode);
2896 2896

  
2897 2897

  
2898 2898
--
......
2904 2904

  
2905 2905

  
2906 2906
--
2907
-- Name: commclass_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2907
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2908 2908
--
2909 2909

  
2910 2910
ALTER TABLE commclass
2911
    ADD CONSTRAINT commclass_keys UNIQUE (locationevent_id, classnotes);
2911
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);
2912 2912

  
2913 2913

  
2914 2914
--
2915
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2915
-- Name: commclass_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2916 2916
--
2917 2917

  
2918 2918
ALTER TABLE commclass
2919
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);
2919
    ADD CONSTRAINT commclass_unique UNIQUE (locationevent_id, classnotes);
2920 2920

  
2921 2921

  
2922 2922
--
2923
-- Name: commconcept_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2923
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2924 2924
--
2925 2925

  
2926 2926
ALTER TABLE commconcept
2927
    ADD CONSTRAINT commconcept_keys UNIQUE (commname_id);
2927
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);
2928 2928

  
2929 2929

  
2930 2930
--
2931
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2931
-- Name: commconcept_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2932 2932
--
2933 2933

  
2934 2934
ALTER TABLE commconcept
2935
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);
2935
    ADD CONSTRAINT commconcept_unique UNIQUE (commname_id);
2936 2936

  
2937 2937

  
2938 2938
--
......
2944 2944

  
2945 2945

  
2946 2946
--
2947
-- Name: commdetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2947
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2948 2948
--
2949 2949

  
2950 2950
ALTER TABLE commdetermination
2951
    ADD CONSTRAINT commdetermination_keys UNIQUE (commclass_id, commconcept_id);
2951
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);
2952 2952

  
2953 2953

  
2954 2954
--
2955
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2955
-- Name: commdetermination_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2956 2956
--
2957 2957

  
2958 2958
ALTER TABLE commdetermination
2959
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);
2959
    ADD CONSTRAINT commdetermination_unique UNIQUE (commclass_id, commconcept_id);
2960 2960

  
2961 2961

  
2962 2962
--
......
2968 2968

  
2969 2969

  
2970 2970
--
2971
-- Name: commname_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2971
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2972 2972
--
2973 2973

  
2974 2974
ALTER TABLE commname
2975
    ADD CONSTRAINT commname_keys UNIQUE (commname);
2975
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);
2976 2976

  
2977 2977

  
2978 2978
--
2979
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2979
-- Name: commname_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
2980 2980
--
2981 2981

  
2982 2982
ALTER TABLE commname
2983
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);
2983
    ADD CONSTRAINT commname_unique UNIQUE (commname);
2984 2984

  
2985 2985

  
2986 2986
--
......
3048 3048

  
3049 3049

  
3050 3050
--
3051
-- Name: growthform_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3051
-- Name: growthform_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3052 3052
--
3053 3053

  
3054 3054
ALTER TABLE growthform
3055
    ADD CONSTRAINT growthform_keys UNIQUE (name);
3055
    ADD CONSTRAINT growthform_pkey PRIMARY KEY (growthform_id);
3056 3056

  
3057 3057

  
3058 3058
--
3059
-- Name: growthform_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3059
-- Name: growthform_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3060 3060
--
3061 3061

  
3062 3062
ALTER TABLE growthform
3063
    ADD CONSTRAINT growthform_pkey PRIMARY KEY (growthform_id);
3063
    ADD CONSTRAINT growthform_unique UNIQUE (name);
3064 3064

  
3065 3065

  
3066 3066
--
3067
-- Name: location_keys_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3067
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3068 3068
--
3069 3069

  
3070 3070
ALTER TABLE location
3071
    ADD CONSTRAINT location_keys_coords UNIQUE (centerlatitude, centerlongitude);
3071
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);
3072 3072

  
3073 3073

  
3074 3074
--
3075
-- Name: location_keys_subplot_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3075
-- Name: location_unique_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3076 3076
--
3077 3077

  
3078 3078
ALTER TABLE location
3079
    ADD CONSTRAINT location_keys_subplot_coords UNIQUE (parent_id, sublocationxposition, sublocationyposition);
3079
    ADD CONSTRAINT location_unique_coords UNIQUE (centerlatitude, centerlongitude);
3080 3080

  
3081 3081

  
3082 3082
--
3083
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3083
-- Name: location_unique_subplot_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3084 3084
--
3085 3085

  
3086 3086
ALTER TABLE location
3087
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);
3087
    ADD CONSTRAINT location_unique_subplot_coords UNIQUE (parent_id, sublocationxposition, sublocationyposition);
3088 3088

  
3089 3089

  
3090 3090
--
3091
-- Name: locationdetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3091
-- Name: locationdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3092 3092
--
3093 3093

  
3094 3094
ALTER TABLE locationdetermination
3095
    ADD CONSTRAINT locationdetermination_keys UNIQUE (location_id, namedplace_id);
3095
    ADD CONSTRAINT locationdetermination_pkey PRIMARY KEY (locationdetermination_id);
3096 3096

  
3097 3097

  
3098 3098
--
3099
-- Name: locationdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3099
-- Name: locationdetermination_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3100 3100
--
3101 3101

  
3102 3102
ALTER TABLE locationdetermination
3103
    ADD CONSTRAINT locationdetermination_pkey PRIMARY KEY (locationdetermination_id);
3103
    ADD CONSTRAINT locationdetermination_unique UNIQUE (location_id, namedplace_id);
3104 3104

  
3105 3105

  
3106 3106
--
3107
-- Name: locationevent_keys_datasource_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3107
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3108 3108
--
3109 3109

  
3110 3110
ALTER TABLE locationevent
3111
    ADD CONSTRAINT locationevent_keys_datasource_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3111
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);
3112 3112

  
3113 3113

  
3114 3114
--
3115
-- Name: locationevent_keys_parent_authorcode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3115
-- Name: locationevent_unique_datasource_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3116 3116
--
3117 3117

  
3118 3118
ALTER TABLE locationevent
3119
    ADD CONSTRAINT locationevent_keys_parent_authorcode UNIQUE (parent_id, authorlocationcode);
3119
    ADD CONSTRAINT locationevent_unique_datasource_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3120 3120

  
3121 3121

  
3122 3122
--
3123
-- Name: locationevent_keys_parent_location; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3123
-- Name: locationevent_unique_parent_authorcode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3124 3124
--
3125 3125

  
3126 3126
ALTER TABLE locationevent
3127
    ADD CONSTRAINT locationevent_keys_parent_location UNIQUE (parent_id, location_id);
3127
    ADD CONSTRAINT locationevent_unique_parent_authorcode UNIQUE (parent_id, authorlocationcode);
3128 3128

  
3129 3129

  
3130 3130
--
3131
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3131
-- Name: locationevent_unique_parent_location; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3132 3132
--
3133 3133

  
3134 3134
ALTER TABLE locationevent
3135
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);
3135
    ADD CONSTRAINT locationevent_unique_parent_location UNIQUE (parent_id, location_id);
3136 3136

  
3137 3137

  
3138 3138
--
......
3176 3176

  
3177 3177

  
3178 3178
--
3179
-- Name: namedplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3179
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3180 3180
--
3181 3181

  
3182 3182
ALTER TABLE namedplace
3183
    ADD CONSTRAINT namedplace_keys UNIQUE (placesystem, placename);
3183
    ADD CONSTRAINT namedplace_pkey PRIMARY KEY (namedplace_id);
3184 3184

  
3185 3185

  
3186 3186
--
3187
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3187
-- Name: namedplace_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3188 3188
--
3189 3189

  
3190 3190
ALTER TABLE namedplace
3191
    ADD CONSTRAINT namedplace_pkey PRIMARY KEY (namedplace_id);
3191
    ADD CONSTRAINT namedplace_unique UNIQUE (placesystem, placename);
3192 3192

  
3193 3193

  
3194 3194
--
......
3288 3288

  
3289 3289

  
3290 3290
--
3291
-- Name: plantstatus_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3291
-- Name: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3292 3292
--
3293 3293

  
3294 3294
ALTER TABLE plantstatus
3295
    ADD CONSTRAINT plantstatus_keys UNIQUE (plantconcept_id, party_id);
3295
    ADD CONSTRAINT plantstatus_pkey PRIMARY KEY (plantstatus_id);
3296 3296

  
3297 3297

  
3298 3298
--
3299
-- Name: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3299
-- Name: plantstatus_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3300 3300
--
3301 3301

  
3302 3302
ALTER TABLE plantstatus
3303
    ADD CONSTRAINT plantstatus_pkey PRIMARY KEY (plantstatus_id);
3303
    ADD CONSTRAINT plantstatus_unique UNIQUE (plantconcept_id, party_id);
3304 3304

  
3305 3305

  
3306 3306
--
......
3312 3312

  
3313 3313

  
3314 3314
--
3315
-- Name: project_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3315
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3316 3316
--
3317 3317

  
3318 3318
ALTER TABLE project
3319
    ADD CONSTRAINT project_keys UNIQUE (datasource_id, projectname);
3319
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);
3320 3320

  
3321 3321

  
3322 3322
--
3323
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3323
-- Name: project_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3324 3324
--
3325 3325

  
3326 3326
ALTER TABLE project
3327
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);
3327
    ADD CONSTRAINT project_unique UNIQUE (datasource_id, projectname);
3328 3328

  
3329 3329

  
3330 3330
--
......
3392 3392

  
3393 3393

  
3394 3394
--
3395
-- Name: soilobs_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3395
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3396 3396
--
3397 3397

  
3398 3398
ALTER TABLE soilobs
3399
    ADD CONSTRAINT soilobs_keys UNIQUE (locationevent_id);
3399
    ADD CONSTRAINT soilobs_pkey PRIMARY KEY (soilobs_id);
3400 3400

  
3401 3401

  
3402 3402
--
3403
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3403
-- Name: soilobs_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3404 3404
--
3405 3405

  
3406 3406
ALTER TABLE soilobs
3407
    ADD CONSTRAINT soilobs_pkey PRIMARY KEY (soilobs_id);
3407
    ADD CONSTRAINT soilobs_unique UNIQUE (locationevent_id);
3408 3408

  
3409 3409

  
3410 3410
--
......
3424 3424

  
3425 3425

  
3426 3426
--
3427
-- Name: specimenreplicate_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3427
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3428 3428
--
3429 3429

  
3430 3430
ALTER TABLE specimenreplicate
3431
    ADD CONSTRAINT specimenreplicate_keys_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3431
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);
3432 3432

  
3433 3433

  
3434 3434
--
3435
-- Name: specimenreplicate_keys_catalognumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3435
-- Name: specimenreplicate_unique_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3436 3436
--
3437 3437

  
3438 3438
ALTER TABLE specimenreplicate
3439
    ADD CONSTRAINT specimenreplicate_keys_catalognumber UNIQUE (datasource_id, collectioncode_dwc, catalognumber_dwc);
3439
    ADD CONSTRAINT specimenreplicate_unique_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3440 3440

  
3441 3441

  
3442 3442
--
3443
-- Name: specimenreplicate_keys_collectionnumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3443
-- Name: specimenreplicate_unique_catalognumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3444 3444
--
3445 3445

  
3446 3446
ALTER TABLE specimenreplicate
3447
    ADD CONSTRAINT specimenreplicate_keys_collectionnumber UNIQUE (datasource_id, collectionnumber);
3447
    ADD CONSTRAINT specimenreplicate_unique_catalognumber UNIQUE (datasource_id, collectioncode_dwc, catalognumber_dwc);
3448 3448

  
3449 3449

  
3450 3450
--
3451
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3451
-- Name: specimenreplicate_unique_collectionnumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3452 3452
--
3453 3453

  
3454 3454
ALTER TABLE specimenreplicate
3455
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);
3455
    ADD CONSTRAINT specimenreplicate_unique_collectionnumber UNIQUE (datasource_id, collectionnumber);
3456 3456

  
3457 3457

  
3458 3458
--
3459
-- Name: stemobservation_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3459
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3460 3460
--
3461 3461

  
3462 3462
ALTER TABLE stemobservation
3463
    ADD CONSTRAINT stemobservation_keys_accessioncode UNIQUE (plantobservation_id, sourceaccessioncode);
3463
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);
3464 3464

  
3465 3465

  
3466 3466
--
3467
-- Name: stemobservation_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3467
-- Name: stemobservation_unique_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3468 3468
--
3469 3469

  
3470 3470
ALTER TABLE stemobservation
3471
    ADD CONSTRAINT stemobservation_keys_code UNIQUE (plantobservation_id, authorstemcode);
3471
    ADD CONSTRAINT stemobservation_unique_accessioncode UNIQUE (plantobservation_id, sourceaccessioncode);
3472 3472

  
3473 3473

  
3474 3474
--
3475
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3475
-- Name: stemobservation_unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3476 3476
--
3477 3477

  
3478 3478
ALTER TABLE stemobservation
3479
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);
3479
    ADD CONSTRAINT stemobservation_unique_code UNIQUE (plantobservation_id, authorstemcode);
3480 3480

  
3481 3481

  
3482 3482
--
......
3488 3488

  
3489 3489

  
3490 3490
--
3491
-- Name: stemtag_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3491
-- Name: stemtag_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3492 3492
--
3493 3493

  
3494 3494
ALTER TABLE stemtag
3495
    ADD CONSTRAINT stemtag_keys UNIQUE (stemobservation_id, tag);
3495
    ADD CONSTRAINT stemtag_pkey PRIMARY KEY (stemtag_id);
3496 3496

  
3497 3497

  
3498 3498
--
3499
-- Name: stemtag_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3499
-- Name: stemtag_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3500 3500
--
3501 3501

  
3502 3502
ALTER TABLE stemtag
3503
    ADD CONSTRAINT stemtag_pkey PRIMARY KEY (stemtag_id);
3503
    ADD CONSTRAINT stemtag_unique UNIQUE (stemobservation_id, tag);
3504 3504

  
3505 3505

  
3506 3506
--
......
3560 3560

  
3561 3561

  
3562 3562
--
3563
-- Name: voucher_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3563
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3564 3564
--
3565 3565

  
3566 3566
ALTER TABLE voucher
3567
    ADD CONSTRAINT voucher_keys UNIQUE (taxonoccurrence_id, specimenreplicate_id);
3567
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);
3568 3568

  
3569 3569

  
3570 3570
--
3571
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3571
-- Name: voucher_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3572 3572
--
3573 3573

  
3574 3574
ALTER TABLE voucher
3575
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);
3575
    ADD CONSTRAINT voucher_unique UNIQUE (taxonoccurrence_id, specimenreplicate_id);
3576 3576

  
3577 3577

  
3578 3578
--
......
4164 4164

  
4165 4165

  
4166 4166
--
4167
-- Name: locationevent_keys_project_authorcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4168
--
4169

  
4170

  
4171

  
4172

  
4173
--
4174 4167
-- Name: locationevent_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4175 4168
--
4176 4169

  
......
4199 4192

  
4200 4193

  
4201 4194
--
4195
-- Name: locationevent_unique_project_authorcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4196
--
4197

  
4198

  
4199

  
4200

  
4201
--
4202 4202
-- Name: locationeventcontributor_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4203 4203
--
4204 4204

  
......
4262 4262

  
4263 4263

  
4264 4264
--
4265
-- Name: method_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4265
-- Name: method_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4266 4266
--
4267 4267

  
4268 4268

  
......
4332 4332

  
4333 4333

  
4334 4334
--
4335
-- Name: party_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4336
--
4337

  
4338

  
4339

  
4340

  
4341
--
4342 4335
-- Name: party_middlename; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4343 4336
--
4344 4337

  
......
4360 4353

  
4361 4354

  
4362 4355
--
4356
-- Name: party_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4357
--
4358

  
4359

  
4360

  
4361

  
4362
--
4363 4363
-- Name: partymember_childparty_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4364 4364
--
4365 4365

  
......
4395 4395

  
4396 4396

  
4397 4397
--
4398
-- Name: plantconcept_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4398
-- Name: plantconcept_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4399 4399
--
4400 4400

  
4401
CREATE INDEX plantconcept_plantname_id_x ON plantconcept  (plantname_id);
4401 4402

  
4402 4403

  
4403

  
4404 4404
--
4405
-- Name: plantconcept_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4405
-- Name: plantconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4406 4406
--
4407 4407

  
4408
CREATE INDEX plantconcept_plantname_id_x ON plantconcept  (plantname_id);
4408
CREATE INDEX plantconcept_reference_id_x ON plantconcept  (reference_id);
4409 4409

  
4410 4410

  
4411 4411
--
4412
-- Name: plantconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4412
-- Name: plantconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4413 4413
--
4414 4414

  
4415
CREATE INDEX plantconcept_reference_id_x ON plantconcept  (reference_id);
4416 4415

  
4417 4416

  
4417

  
4418 4418
--
4419
-- Name: plantconceptscope_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4419
-- Name: plantconceptscope_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4420 4420
--
4421 4421

  
4422 4422

  
......
4696 4696

  
4697 4697

  
4698 4698
--
4699
-- Name: taxondetermination_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4700
--
4701

  
4702

  
4703

  
4704

  
4705
--
4706 4699
-- Name: taxondetermination_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4707 4700
--
4708 4701

  
......
4738 4731

  
4739 4732

  
4740 4733
--
4734
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4735
--
4736

  
4737

  
4738

  
4739

  
4740
--
4741 4741
-- Name: taxonoccurrence_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4742 4742
--
4743 4743

  
schemas/vegbien.sql
3272 3272

  
3273 3273

  
3274 3274
--
3275
-- Name: aggregateoccurrence_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3275
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3276 3276
--
3277 3277

  
3278 3278
ALTER TABLE ONLY aggregateoccurrence
3279
    ADD CONSTRAINT aggregateoccurrence_keys_accessioncode UNIQUE (taxonoccurrence_id, sourceaccessioncode);
3279
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);
3280 3280

  
3281 3281

  
3282 3282
--
3283
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3283
-- Name: aggregateoccurrence_unique_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3284 3284
--
3285 3285

  
3286 3286
ALTER TABLE ONLY aggregateoccurrence
3287
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);
3287
    ADD CONSTRAINT aggregateoccurrence_unique_accessioncode UNIQUE (taxonoccurrence_id, sourceaccessioncode);
3288 3288

  
3289 3289

  
3290 3290
--
......
3296 3296

  
3297 3297

  
3298 3298
--
3299
-- Name: commclass_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3299
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3300 3300
--
3301 3301

  
3302 3302
ALTER TABLE ONLY commclass
3303
    ADD CONSTRAINT commclass_keys UNIQUE (locationevent_id, classnotes);
3303
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);
3304 3304

  
3305 3305

  
3306 3306
--
3307
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3307
-- Name: commclass_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3308 3308
--
3309 3309

  
3310 3310
ALTER TABLE ONLY commclass
3311
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);
3311
    ADD CONSTRAINT commclass_unique UNIQUE (locationevent_id, classnotes);
3312 3312

  
3313 3313

  
3314 3314
--
3315
-- Name: commconcept_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3315
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3316 3316
--
3317 3317

  
3318 3318
ALTER TABLE ONLY commconcept
3319
    ADD CONSTRAINT commconcept_keys UNIQUE (commname_id);
3319
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);
3320 3320

  
3321 3321

  
3322 3322
--
3323
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3323
-- Name: commconcept_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3324 3324
--
3325 3325

  
3326 3326
ALTER TABLE ONLY commconcept
3327
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);
3327
    ADD CONSTRAINT commconcept_unique UNIQUE (commname_id);
3328 3328

  
3329 3329

  
3330 3330
--
......
3336 3336

  
3337 3337

  
3338 3338
--
3339
-- Name: commdetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3339
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3340 3340
--
3341 3341

  
3342 3342
ALTER TABLE ONLY commdetermination
3343
    ADD CONSTRAINT commdetermination_keys UNIQUE (commclass_id, commconcept_id);
3343
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);
3344 3344

  
3345 3345

  
3346 3346
--
3347
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3347
-- Name: commdetermination_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3348 3348
--
3349 3349

  
3350 3350
ALTER TABLE ONLY commdetermination
3351
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);
3351
    ADD CONSTRAINT commdetermination_unique UNIQUE (commclass_id, commconcept_id);
3352 3352

  
3353 3353

  
3354 3354
--
......
3360 3360

  
3361 3361

  
3362 3362
--
3363
-- Name: commname_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3363
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3364 3364
--
3365 3365

  
3366 3366
ALTER TABLE ONLY commname
3367
    ADD CONSTRAINT commname_keys UNIQUE (commname);
3367
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);
3368 3368

  
3369 3369

  
3370 3370
--
3371
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3371
-- Name: commname_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3372 3372
--
3373 3373

  
3374 3374
ALTER TABLE ONLY commname
3375
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);
3375
    ADD CONSTRAINT commname_unique UNIQUE (commname);
3376 3376

  
3377 3377

  
3378 3378
--
......
3440 3440

  
3441 3441

  
3442 3442
--
3443
-- Name: growthform_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3443
-- Name: growthform_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3444 3444
--
3445 3445

  
3446 3446
ALTER TABLE ONLY growthform
3447
    ADD CONSTRAINT growthform_keys UNIQUE (name);
3447
    ADD CONSTRAINT growthform_pkey PRIMARY KEY (growthform_id);
3448 3448

  
3449 3449

  
3450 3450
--
3451
-- Name: growthform_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3451
-- Name: growthform_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3452 3452
--
3453 3453

  
3454 3454
ALTER TABLE ONLY growthform
3455
    ADD CONSTRAINT growthform_pkey PRIMARY KEY (growthform_id);
3455
    ADD CONSTRAINT growthform_unique UNIQUE (name);
3456 3456

  
3457 3457

  
3458 3458
--
3459
-- Name: location_keys_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3459
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3460 3460
--
3461 3461

  
3462 3462
ALTER TABLE ONLY location
3463
    ADD CONSTRAINT location_keys_coords UNIQUE (centerlatitude, centerlongitude);
3463
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);
3464 3464

  
3465 3465

  
3466 3466
--
3467
-- Name: location_keys_subplot_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3467
-- Name: location_unique_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3468 3468
--
3469 3469

  
3470 3470
ALTER TABLE ONLY location
3471
    ADD CONSTRAINT location_keys_subplot_coords UNIQUE (parent_id, sublocationxposition, sublocationyposition);
3471
    ADD CONSTRAINT location_unique_coords UNIQUE (centerlatitude, centerlongitude);
3472 3472

  
3473 3473

  
3474 3474
--
3475
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3475
-- Name: location_unique_subplot_coords; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3476 3476
--
3477 3477

  
3478 3478
ALTER TABLE ONLY location
3479
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);
3479
    ADD CONSTRAINT location_unique_subplot_coords UNIQUE (parent_id, sublocationxposition, sublocationyposition);
3480 3480

  
3481 3481

  
3482 3482
--
3483
-- Name: locationdetermination_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3483
-- Name: locationdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3484 3484
--
3485 3485

  
3486 3486
ALTER TABLE ONLY locationdetermination
3487
    ADD CONSTRAINT locationdetermination_keys UNIQUE (location_id, namedplace_id);
3487
    ADD CONSTRAINT locationdetermination_pkey PRIMARY KEY (locationdetermination_id);
3488 3488

  
3489 3489

  
3490 3490
--
3491
-- Name: locationdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3491
-- Name: locationdetermination_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3492 3492
--
3493 3493

  
3494 3494
ALTER TABLE ONLY locationdetermination
3495
    ADD CONSTRAINT locationdetermination_pkey PRIMARY KEY (locationdetermination_id);
3495
    ADD CONSTRAINT locationdetermination_unique UNIQUE (location_id, namedplace_id);
3496 3496

  
3497 3497

  
3498 3498
--
3499
-- Name: locationevent_keys_datasource_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3499
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3500 3500
--
3501 3501

  
3502 3502
ALTER TABLE ONLY locationevent
3503
    ADD CONSTRAINT locationevent_keys_datasource_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3503
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);
3504 3504

  
3505 3505

  
3506 3506
--
3507
-- Name: locationevent_keys_parent_authorcode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3507
-- Name: locationevent_unique_datasource_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3508 3508
--
3509 3509

  
3510 3510
ALTER TABLE ONLY locationevent
3511
    ADD CONSTRAINT locationevent_keys_parent_authorcode UNIQUE (parent_id, authorlocationcode);
3511
    ADD CONSTRAINT locationevent_unique_datasource_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3512 3512

  
3513 3513

  
3514 3514
--
3515
-- Name: locationevent_keys_parent_location; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3515
-- Name: locationevent_unique_parent_authorcode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3516 3516
--
3517 3517

  
3518 3518
ALTER TABLE ONLY locationevent
3519
    ADD CONSTRAINT locationevent_keys_parent_location UNIQUE (parent_id, location_id);
3519
    ADD CONSTRAINT locationevent_unique_parent_authorcode UNIQUE (parent_id, authorlocationcode);
3520 3520

  
3521 3521

  
3522 3522
--
3523
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3523
-- Name: locationevent_unique_parent_location; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3524 3524
--
3525 3525

  
3526 3526
ALTER TABLE ONLY locationevent
3527
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);
3527
    ADD CONSTRAINT locationevent_unique_parent_location UNIQUE (parent_id, location_id);
3528 3528

  
3529 3529

  
3530 3530
--
......
3568 3568

  
3569 3569

  
3570 3570
--
3571
-- Name: namedplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3571
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3572 3572
--
3573 3573

  
3574 3574
ALTER TABLE ONLY namedplace
3575
    ADD CONSTRAINT namedplace_keys UNIQUE (placesystem, placename);
3575
    ADD CONSTRAINT namedplace_pkey PRIMARY KEY (namedplace_id);
3576 3576

  
3577 3577

  
3578 3578
--
3579
-- Name: namedplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3579
-- Name: namedplace_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3580 3580
--
3581 3581

  
3582 3582
ALTER TABLE ONLY namedplace
3583
    ADD CONSTRAINT namedplace_pkey PRIMARY KEY (namedplace_id);
3583
    ADD CONSTRAINT namedplace_unique UNIQUE (placesystem, placename);
3584 3584

  
3585 3585

  
3586 3586
--
......
3680 3680

  
3681 3681

  
3682 3682
--
3683
-- Name: plantstatus_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3683
-- Name: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3684 3684
--
3685 3685

  
3686 3686
ALTER TABLE ONLY plantstatus
3687
    ADD CONSTRAINT plantstatus_keys UNIQUE (plantconcept_id, party_id);
3687
    ADD CONSTRAINT plantstatus_pkey PRIMARY KEY (plantstatus_id);
3688 3688

  
3689 3689

  
3690 3690
--
3691
-- Name: plantstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3691
-- Name: plantstatus_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3692 3692
--
3693 3693

  
3694 3694
ALTER TABLE ONLY plantstatus
3695
    ADD CONSTRAINT plantstatus_pkey PRIMARY KEY (plantstatus_id);
3695
    ADD CONSTRAINT plantstatus_unique UNIQUE (plantconcept_id, party_id);
3696 3696

  
3697 3697

  
3698 3698
--
......
3704 3704

  
3705 3705

  
3706 3706
--
3707
-- Name: project_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3707
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3708 3708
--
3709 3709

  
3710 3710
ALTER TABLE ONLY project
3711
    ADD CONSTRAINT project_keys UNIQUE (datasource_id, projectname);
3711
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);
3712 3712

  
3713 3713

  
3714 3714
--
3715
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3715
-- Name: project_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3716 3716
--
3717 3717

  
3718 3718
ALTER TABLE ONLY project
3719
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);
3719
    ADD CONSTRAINT project_unique UNIQUE (datasource_id, projectname);
3720 3720

  
3721 3721

  
3722 3722
--
......
3784 3784

  
3785 3785

  
3786 3786
--
3787
-- Name: soilobs_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3787
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3788 3788
--
3789 3789

  
3790 3790
ALTER TABLE ONLY soilobs
3791
    ADD CONSTRAINT soilobs_keys UNIQUE (locationevent_id);
3791
    ADD CONSTRAINT soilobs_pkey PRIMARY KEY (soilobs_id);
3792 3792

  
3793 3793

  
3794 3794
--
3795
-- Name: soilobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3795
-- Name: soilobs_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3796 3796
--
3797 3797

  
3798 3798
ALTER TABLE ONLY soilobs
3799
    ADD CONSTRAINT soilobs_pkey PRIMARY KEY (soilobs_id);
3799
    ADD CONSTRAINT soilobs_unique UNIQUE (locationevent_id);
3800 3800

  
3801 3801

  
3802 3802
--
......
3816 3816

  
3817 3817

  
3818 3818
--
3819
-- Name: specimenreplicate_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3819
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3820 3820
--
3821 3821

  
3822 3822
ALTER TABLE ONLY specimenreplicate
3823
    ADD CONSTRAINT specimenreplicate_keys_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3823
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);
3824 3824

  
3825 3825

  
3826 3826
--
3827
-- Name: specimenreplicate_keys_catalognumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3827
-- Name: specimenreplicate_unique_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3828 3828
--
3829 3829

  
3830 3830
ALTER TABLE ONLY specimenreplicate
3831
    ADD CONSTRAINT specimenreplicate_keys_catalognumber UNIQUE (datasource_id, collectioncode_dwc, catalognumber_dwc);
3831
    ADD CONSTRAINT specimenreplicate_unique_accessioncode UNIQUE (datasource_id, sourceaccessioncode);
3832 3832

  
3833 3833

  
3834 3834
--
3835
-- Name: specimenreplicate_keys_collectionnumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3835
-- Name: specimenreplicate_unique_catalognumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3836 3836
--
3837 3837

  
3838 3838
ALTER TABLE ONLY specimenreplicate
3839
    ADD CONSTRAINT specimenreplicate_keys_collectionnumber UNIQUE (datasource_id, collectionnumber);
3839
    ADD CONSTRAINT specimenreplicate_unique_catalognumber UNIQUE (datasource_id, collectioncode_dwc, catalognumber_dwc);
3840 3840

  
3841 3841

  
3842 3842
--
3843
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3843
-- Name: specimenreplicate_unique_collectionnumber; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3844 3844
--
3845 3845

  
3846 3846
ALTER TABLE ONLY specimenreplicate
3847
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);
3847
    ADD CONSTRAINT specimenreplicate_unique_collectionnumber UNIQUE (datasource_id, collectionnumber);
3848 3848

  
3849 3849

  
3850 3850
--
3851
-- Name: stemobservation_keys_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3851
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3852 3852
--
3853 3853

  
3854 3854
ALTER TABLE ONLY stemobservation
3855
    ADD CONSTRAINT stemobservation_keys_accessioncode UNIQUE (plantobservation_id, sourceaccessioncode);
3855
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);
3856 3856

  
3857 3857

  
3858 3858
--
3859
-- Name: stemobservation_keys_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3859
-- Name: stemobservation_unique_accessioncode; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3860 3860
--
3861 3861

  
3862 3862
ALTER TABLE ONLY stemobservation
3863
    ADD CONSTRAINT stemobservation_keys_code UNIQUE (plantobservation_id, authorstemcode);
3863
    ADD CONSTRAINT stemobservation_unique_accessioncode UNIQUE (plantobservation_id, sourceaccessioncode);
3864 3864

  
3865 3865

  
3866 3866
--
3867
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3867
-- Name: stemobservation_unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3868 3868
--
3869 3869

  
3870 3870
ALTER TABLE ONLY stemobservation
3871
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);
3871
    ADD CONSTRAINT stemobservation_unique_code UNIQUE (plantobservation_id, authorstemcode);
3872 3872

  
3873 3873

  
3874 3874
--
......
3880 3880

  
3881 3881

  
3882 3882
--
3883
-- Name: stemtag_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3883
-- Name: stemtag_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3884 3884
--
3885 3885

  
3886 3886
ALTER TABLE ONLY stemtag
3887
    ADD CONSTRAINT stemtag_keys UNIQUE (stemobservation_id, tag);
3887
    ADD CONSTRAINT stemtag_pkey PRIMARY KEY (stemtag_id);
3888 3888

  
3889 3889

  
3890 3890
--
3891
-- Name: stemtag_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3891
-- Name: stemtag_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3892 3892
--
3893 3893

  
3894 3894
ALTER TABLE ONLY stemtag
3895
    ADD CONSTRAINT stemtag_pkey PRIMARY KEY (stemtag_id);
3895
    ADD CONSTRAINT stemtag_unique UNIQUE (stemobservation_id, tag);
3896 3896

  
3897 3897

  
3898 3898
--
......
3952 3952

  
3953 3953

  
3954 3954
--
3955
-- Name: voucher_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3955
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3956 3956
--
3957 3957

  
3958 3958
ALTER TABLE ONLY voucher
3959
    ADD CONSTRAINT voucher_keys UNIQUE (taxonoccurrence_id, specimenreplicate_id);
3959
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);
3960 3960

  
3961 3961

  
3962 3962
--
3963
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3963
-- Name: voucher_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3964 3964
--
3965 3965

  
3966 3966
ALTER TABLE ONLY voucher
3967
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);
3967
    ADD CONSTRAINT voucher_unique UNIQUE (taxonoccurrence_id, specimenreplicate_id);
3968 3968

  
3969 3969

  
3970 3970
--
......
4556 4556

  
4557 4557

  
4558 4558
--
4559
-- Name: locationevent_keys_project_authorcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4560
--
4561

  
4562
CREATE UNIQUE INDEX locationevent_keys_project_authorcode ON locationevent USING btree (project_id, authorlocationcode, obsstartdate) WHERE (parent_id IS NULL);
4563

  
4564

  
4565
--
4566 4559
-- Name: locationevent_location_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4567 4560
--
4568 4561

  
......
4591 4584

  
4592 4585

  
4593 4586
--
4587
-- Name: locationevent_unique_project_authorcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4588
--
4589

  
4590
CREATE UNIQUE INDEX locationevent_unique_project_authorcode ON locationevent USING btree (project_id, authorlocationcode, obsstartdate) WHERE (parent_id IS NULL);
4591

  
4592

  
4593
--
4594 4594
-- Name: locationeventcontributor_locationevent_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4595 4595
--
4596 4596

  
......
4654 4654

  
4655 4655

  
4656 4656
--
4657
-- Name: method_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4657
-- Name: method_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4658 4658
--
4659 4659

  
4660
CREATE UNIQUE INDEX method_keys ON method USING btree (name, (COALESCE(description, ''::text)));
4660
CREATE UNIQUE INDEX method_unique ON method USING btree (name, (COALESCE(description, ''::text)));
4661 4661

  
4662 4662

  
4663 4663
--
......
4724 4724

  
4725 4725

  
4726 4726
--
4727
-- Name: party_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4728
--
4729

  
4730
CREATE UNIQUE INDEX party_keys ON party USING btree ((COALESCE(givenname, ''::text)), (COALESCE(middlename, ''::text)), (COALESCE(surname, ''::text)), (COALESCE(organizationname, ''::text)));
4731

  
4732

  
4733
--
4734 4727
-- Name: party_middlename; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4735 4728
--
4736 4729

  
......
4752 4745

  
4753 4746

  
4754 4747
--
4748
-- Name: party_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4749
--
4750

  
4751
CREATE UNIQUE INDEX party_unique ON party USING btree ((COALESCE(givenname, ''::text)), (COALESCE(middlename, ''::text)), (COALESCE(surname, ''::text)), (COALESCE(organizationname, ''::text)));
4752

  
4753

  
4754
--
4755 4755
-- Name: partymember_childparty_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4756 4756
--
4757 4757

  
......
4787 4787

  
4788 4788

  
4789 4789
--
4790
-- Name: plantconcept_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4790
-- Name: plantconcept_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4791 4791
--
4792 4792

  
4793
CREATE UNIQUE INDEX plantconcept_keys ON plantconcept USING btree ((COALESCE(scope_id, 0)), (COALESCE(reference_id, 0)), plantname_id);
4793
CREATE INDEX plantconcept_plantname_id_x ON plantconcept USING btree (plantname_id);
4794 4794

  
4795 4795

  
4796 4796
--
4797
-- Name: plantconcept_plantname_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4797
-- Name: plantconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4798 4798
--
4799 4799

  
4800
CREATE INDEX plantconcept_plantname_id_x ON plantconcept USING btree (plantname_id);
4800
CREATE INDEX plantconcept_reference_id_x ON plantconcept USING btree (reference_id);
4801 4801

  
4802 4802

  
4803 4803
--
4804
-- Name: plantconcept_reference_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4804
-- Name: plantconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4805 4805
--
4806 4806

  
4807
CREATE INDEX plantconcept_reference_id_x ON plantconcept USING btree (reference_id);
4807
CREATE UNIQUE INDEX plantconcept_unique ON plantconcept USING btree ((COALESCE(scope_id, 0)), (COALESCE(reference_id, 0)), plantname_id);
4808 4808

  
4809 4809

  
4810 4810
--
4811
-- Name: plantconceptscope_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4811
-- Name: plantconceptscope_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4812 4812
--
4813 4813

  
4814
CREATE UNIQUE INDEX plantconceptscope_keys ON plantconceptscope USING btree ((COALESCE(locationevent_id, 0)), (COALESCE(project_id, 0)), (COALESCE(namedplace_id, 0)));
4814
CREATE UNIQUE INDEX plantconceptscope_unique ON plantconceptscope USING btree ((COALESCE(locationevent_id, 0)), (COALESCE(project_id, 0)), (COALESCE(namedplace_id, 0)));
4815 4815

  
4816 4816

  
4817 4817
--
......
5088 5088

  
5089 5089

  
5090 5090
--
5091
-- Name: taxondetermination_keys; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5092
--
5093

  
5094
CREATE UNIQUE INDEX taxondetermination_keys ON taxondetermination USING btree (taxonoccurrence_id, role_id, (COALESCE(party_id, 0)), plantconcept_id);
5095

  
5096

  
5097
--
5098 5091
-- Name: taxondetermination_party_id_x; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5099 5092
--
5100 5093

  
......
5130 5123

  
5131 5124

  
5132 5125
--
5126
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5127
--
5128

  
5129
CREATE UNIQUE INDEX taxondetermination_unique ON taxondetermination USING btree (taxonoccurrence_id, role_id, (COALESCE(party_id, 0)), plantconcept_id);
5130

  
5131

  
5132
--
5133 5133
-- Name: taxonoccurrence_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5134 5134
--
5135 5135

  

Also available in: Unified diff