Project

General

Profile

« Previous | Next » 

Revision 5499

schemas/vegbien.sql: Changed `timestamp with time zone` fields to `date` because time information is not stored in these fields, and it's confusing to have an arbitrary timezone (the server's timezone) and an arbitrary time (midnight) set for input data that only has a precision to the nearest day

View differences:

schemas/vegbien.my.sql
206 206
    postalcode text,
207 207
    country text,
208 208
    currentflag int(1),
209
    addressstartdate timestamp NULL
209
    addressstartdate date
210 210
);
211 211

  
212 212

  
......
233 233
    creator_id int(11) NOT NULL,
234 234
    sourceaccessioncode text,
235 235
    taxonoccurrence_id int(11) NOT NULL,
236
    collectiondate timestamp NULL,
236
    collectiondate date,
237 237
    cover_fraction double precision,
238 238
    linecover_m double precision,
239 239
    basalarea_m2 double precision,
......
329 329
    notespublic int(1),
330 330
    notesmgt int(1),
331 331
    revisions int(1),
332
    dateentered timestamp NULL ,
332
    dateentered date ,
333 333
    locationrationalenarrative text,
334 334
    accessioncode text
335 335
);
......
357 357
    footprintgeometry_dwc text,
358 358
    coordsaccuracy_deg double precision,
359 359
    identifier_id int(11),
360
    determinationdate timestamp NULL,
360
    determinationdate date,
361 361
    isoriginal int(1) DEFAULT false NOT NULL,
362 362
    iscurrent int(1) DEFAULT false NOT NULL,
363 363
    calculated int(1)
......
449 449
    notespublic int(1),
450 450
    notesmgt int(1),
451 451
    revisions int(1),
452
    obsstartdate timestamp NULL,
453
    obsenddate timestamp NULL,
454
    dateentered timestamp NULL ,
452
    obsstartdate date,
453
    obsenddate date,
454
    dateentered date ,
455 455
    toptaxon1name text,
456 456
    toptaxon2name text,
457 457
    toptaxon3name text,
......
803 803
    taxonconcept_id int(11) NOT NULL,
804 804
    creator_id int(11) NOT NULL,
805 805
    sourceaccessioncode text,
806
    creationdate timestamp NULL,
806
    creationdate date,
807 807
    accepted_concept_id int(11),
808 808
    matched_concept_id int(11),
809 809
    matched_concept_fit_fraction double precision,
......
970 970
    notespublic int(1),
971 971
    notesmgt int(1),
972 972
    revisions int(1),
973
    determinationdate timestamp NULL,
973
    determinationdate date,
974 974
    accessioncode text
975 975
);
976 976

  
......
1079 1079
    commcode text,
1080 1080
    commframework text,
1081 1081
    commlevel text,
1082
    classstartdate timestamp NULL,
1083
    classstopdate timestamp NULL,
1082
    classstartdate date,
1083
    classstopdate date,
1084 1084
    expertsystem text,
1085 1085
    accessioncode text
1086 1086
);
......
1139 1139
    commstatus_id int(11) NOT NULL,
1140 1140
    commconcept_id int(11) NOT NULL,
1141 1141
    commconvergence text NOT NULL,
1142
    correlationstart timestamp NOT NULL,
1143
    correlationstop timestamp NULL
1142
    correlationstart date NOT NULL,
1143
    correlationstop date
1144 1144
);
1145 1145

  
1146 1146

  
......
1224 1224
    commname_id int(11) NOT NULL,
1225 1225
    commname text NOT NULL,
1226 1226
    reference_id int(11),
1227
    dateentered timestamp NULL 
1227
    dateentered date 
1228 1228
);
1229 1229

  
1230 1230

  
......
1255 1255
    commlevel text,
1256 1256
    commpartycomments text,
1257 1257
    party_id int(11) NOT NULL,
1258
    startdate timestamp NOT NULL,
1259
    stopdate timestamp NULL,
1258
    startdate date NOT NULL,
1259
    stopdate date,
1260 1260
    accessioncode text
1261 1261
);
1262 1262

  
......
1288 1288
    classsystem text,
1289 1289
    party_id int(11),
1290 1290
    commstatus_id int(11),
1291
    usagestart timestamp NULL,
1292
    usagestop timestamp NULL
1291
    usagestart date,
1292
    usagestop date
1293 1293
);
1294 1294

  
1295 1295

  
......
1437 1437
    graphicdescription text,
1438 1438
    graphictype text,
1439 1439
    graphicdata int(11),
1440
    graphicdate timestamp NULL,
1440
    graphicdate date,
1441 1441
    accessioncode text
1442 1442
);
1443 1443

  
......
1507 1507
    locationevent_id int(11) NOT NULL,
1508 1508
    party_id int(11) NOT NULL,
1509 1509
    role text NOT NULL,
1510
    contributiondate timestamp NULL
1510
    contributiondate date
1511 1511
);
1512 1512

  
1513 1513

  
......
1536 1536
    party_id int(11) NOT NULL,
1537 1537
    role text NOT NULL,
1538 1538
    synonymcomment text,
1539
    classstartdate timestamp NULL  NOT NULL,
1540
    classstopdate timestamp NULL,
1539
    classstartdate date  NOT NULL,
1540
    classstopdate date,
1541 1541
    accessioncode text
1542 1542
);
1543 1543

  
......
1637 1637
    role text NOT NULL,
1638 1638
    notetype text NOT NULL,
1639 1639
    notetext text NOT NULL,
1640
    notedate timestamp NULL,
1640
    notedate date,
1641 1641
    accessioncode text
1642 1642
);
1643 1643

  
......
1705 1705
    parentparty_id int(11) NOT NULL,
1706 1706
    childparty_id int(11) NOT NULL,
1707 1707
    role text,
1708
    memberstart timestamp NULL  NOT NULL,
1709
    memberstop timestamp NULL
1708
    memberstart date  NOT NULL,
1709
    memberstop date
1710 1710
);
1711 1711

  
1712 1712

  
......
1871 1871
    sourceaccessioncode text,
1872 1872
    projectname text,
1873 1873
    projectdescription text,
1874
    startdate timestamp NULL,
1875
    stopdate timestamp NULL,
1874
    startdate date,
1875
    stopdate date,
1876 1876
    d_obscount int(11),
1877
    d_lastlocationaddeddate timestamp NULL,
1877
    d_lastlocationaddeddate date,
1878 1878
    accessioncode text
1879 1879
);
1880 1880

  
......
1949 1949
    url text,
1950 1950
    doi text,
1951 1951
    additionalinfo text,
1952
    pubdate timestamp NULL,
1953
    accessdate timestamp NULL,
1954
    conferencedate timestamp NULL,
1952
    pubdate date,
1953
    accessdate date,
1954
    conferencedate date,
1955 1955
    accessioncode text
1956 1956
);
1957 1957

  
......
2094 2094
    previousvaluetext text NOT NULL,
2095 2095
    previousvaluetype text NOT NULL,
2096 2096
    previousrevision_id int(11),
2097
    revisiondate timestamp NOT NULL
2097
    revisiondate date NOT NULL
2098 2098
);
2099 2099

  
2100 2100

  
......
2383 2383
    taxonstatus_id int(11) NOT NULL,
2384 2384
    taxonconcept_id int(11) NOT NULL,
2385 2385
    plantconvergence text NOT NULL,
2386
    correlationstart timestamp NOT NULL,
2387
    correlationstop timestamp NULL
2386
    correlationstart date NOT NULL,
2387
    correlationstop date
2388 2388
);
2389 2389

  
2390 2390

  
......
2466 2466
    taxonconceptstatus text DEFAULT 'undetermined' NOT NULL,
2467 2467
    reference_id int(11),
2468 2468
    plantpartycomments text,
2469
    startdate timestamp NULL,
2470
    stopdate timestamp NULL,
2469
    startdate date,
2470
    stopdate date,
2471 2471
    accessioncode text
2472 2472
);
2473 2473

  
......
2499 2499
    acceptedsynonym text,
2500 2500
    party_id int(11),
2501 2501
    taxonstatus_id int(11),
2502
    usagestart timestamp NULL,
2503
    usagestop timestamp NULL
2502
    usagestart date,
2503
    usagestop date
2504 2504
);
2505 2505

  
2506 2506

  
schemas/vegbien.sql
533 533
    postalcode text,
534 534
    country text,
535 535
    currentflag boolean,
536
    addressstartdate timestamp with time zone
536
    addressstartdate date
537 537
);
538 538

  
539 539

  
......
565 565
    creator_id integer NOT NULL,
566 566
    sourceaccessioncode text,
567 567
    taxonoccurrence_id integer NOT NULL,
568
    collectiondate timestamp with time zone,
568
    collectiondate date,
569 569
    cover_fraction double precision,
570 570
    linecover_m double precision,
571 571
    basalarea_m2 double precision,
......
666 666
    notespublic boolean,
667 667
    notesmgt boolean,
668 668
    revisions boolean,
669
    dateentered timestamp with time zone DEFAULT now(),
669
    dateentered date DEFAULT now(),
670 670
    locationrationalenarrative text,
671 671
    accessioncode text,
672 672
    CONSTRAINT location_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (authorlocationcode IS NOT NULL)))
......
695 695
    footprintgeometry_dwc text,
696 696
    coordsaccuracy_deg double precision,
697 697
    identifier_id integer,
698
    determinationdate timestamp with time zone,
698
    determinationdate date,
699 699
    isoriginal boolean DEFAULT false NOT NULL,
700 700
    iscurrent boolean DEFAULT false NOT NULL,
701 701
    calculated boolean
......
787 787
    notespublic boolean,
788 788
    notesmgt boolean,
789 789
    revisions boolean,
790
    obsstartdate timestamp with time zone,
791
    obsenddate timestamp with time zone,
792
    dateentered timestamp with time zone DEFAULT now(),
790
    obsstartdate date,
791
    obsenddate date,
792
    dateentered date DEFAULT now(),
793 793
    toptaxon1name text,
794 794
    toptaxon2name text,
795 795
    toptaxon3name text,
......
1172 1172
    taxonconcept_id integer NOT NULL,
1173 1173
    creator_id integer NOT NULL,
1174 1174
    sourceaccessioncode text,
1175
    creationdate timestamp with time zone,
1175
    creationdate date,
1176 1176
    accepted_concept_id integer,
1177 1177
    matched_concept_id integer,
1178 1178
    matched_concept_fit_fraction double precision,
......
1362 1362
    notespublic boolean,
1363 1363
    notesmgt boolean,
1364 1364
    revisions boolean,
1365
    determinationdate timestamp with time zone,
1365
    determinationdate date,
1366 1366
    accessioncode text
1367 1367
);
1368 1368

  
......
1476 1476
    commcode text,
1477 1477
    commframework text,
1478 1478
    commlevel text,
1479
    classstartdate timestamp with time zone,
1480
    classstopdate timestamp with time zone,
1479
    classstartdate date,
1480
    classstopdate date,
1481 1481
    expertsystem text,
1482 1482
    accessioncode text
1483 1483
);
......
1546 1546
    commstatus_id integer NOT NULL,
1547 1547
    commconcept_id integer NOT NULL,
1548 1548
    commconvergence text NOT NULL,
1549
    correlationstart timestamp with time zone NOT NULL,
1550
    correlationstop timestamp with time zone
1549
    correlationstart date NOT NULL,
1550
    correlationstop date
1551 1551
);
1552 1552

  
1553 1553

  
......
1646 1646
    commname_id integer NOT NULL,
1647 1647
    commname text NOT NULL,
1648 1648
    reference_id integer,
1649
    dateentered timestamp with time zone DEFAULT now()
1649
    dateentered date DEFAULT now()
1650 1650
);
1651 1651

  
1652 1652

  
......
1682 1682
    commlevel text,
1683 1683
    commpartycomments text,
1684 1684
    party_id integer NOT NULL,
1685
    startdate timestamp with time zone NOT NULL,
1686
    stopdate timestamp with time zone,
1685
    startdate date NOT NULL,
1686
    stopdate date,
1687 1687
    accessioncode text
1688 1688
);
1689 1689

  
......
1720 1720
    classsystem text,
1721 1721
    party_id integer,
1722 1722
    commstatus_id integer,
1723
    usagestart timestamp with time zone,
1724
    usagestop timestamp with time zone
1723
    usagestart date,
1724
    usagestop date
1725 1725
);
1726 1726

  
1727 1727

  
......
1899 1899
    graphicdescription text,
1900 1900
    graphictype text,
1901 1901
    graphicdata oid,
1902
    graphicdate timestamp with time zone,
1902
    graphicdate date,
1903 1903
    accessioncode text
1904 1904
);
1905 1905

  
......
1989 1989
    locationevent_id integer NOT NULL,
1990 1990
    party_id integer NOT NULL,
1991 1991
    role role NOT NULL,
1992
    contributiondate timestamp with time zone
1992
    contributiondate date
1993 1993
);
1994 1994

  
1995 1995

  
......
2023 2023
    party_id integer NOT NULL,
2024 2024
    role role NOT NULL,
2025 2025
    synonymcomment text,
2026
    classstartdate timestamp with time zone DEFAULT now() NOT NULL,
2027
    classstopdate timestamp with time zone,
2026
    classstartdate date DEFAULT now() NOT NULL,
2027
    classstopdate date,
2028 2028
    accessioncode text
2029 2029
);
2030 2030

  
......
2145 2145
    role role NOT NULL,
2146 2146
    notetype text NOT NULL,
2147 2147
    notetext text NOT NULL,
2148
    notedate timestamp with time zone,
2148
    notedate date,
2149 2149
    accessioncode text
2150 2150
);
2151 2151

  
......
2228 2228
    parentparty_id integer NOT NULL,
2229 2229
    childparty_id integer NOT NULL,
2230 2230
    role role,
2231
    memberstart timestamp with time zone DEFAULT now() NOT NULL,
2232
    memberstop timestamp with time zone
2231
    memberstart date DEFAULT now() NOT NULL,
2232
    memberstop date
2233 2233
);
2234 2234

  
2235 2235

  
......
2426 2426
    sourceaccessioncode text,
2427 2427
    projectname text,
2428 2428
    projectdescription text,
2429
    startdate timestamp with time zone,
2430
    stopdate timestamp with time zone,
2429
    startdate date,
2430
    stopdate date,
2431 2431
    d_obscount integer,
2432
    d_lastlocationaddeddate timestamp with time zone,
2432
    d_lastlocationaddeddate date,
2433 2433
    accessioncode text,
2434 2434
    CONSTRAINT project_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (projectname IS NOT NULL)))
2435 2435
);
......
2515 2515
    url text,
2516 2516
    doi text,
2517 2517
    additionalinfo text,
2518
    pubdate timestamp with time zone,
2519
    accessdate timestamp with time zone,
2520
    conferencedate timestamp with time zone,
2518
    pubdate date,
2519
    accessdate date,
2520
    conferencedate date,
2521 2521
    accessioncode text
2522 2522
);
2523 2523

  
......
2685 2685
    previousvaluetext text NOT NULL,
2686 2686
    previousvaluetype text NOT NULL,
2687 2687
    previousrevision_id integer,
2688
    revisiondate timestamp with time zone NOT NULL
2688
    revisiondate date NOT NULL
2689 2689
);
2690 2690

  
2691 2691

  
......
3019 3019
    taxonstatus_id integer NOT NULL,
3020 3020
    taxonconcept_id integer NOT NULL,
3021 3021
    plantconvergence text NOT NULL,
3022
    correlationstart timestamp with time zone NOT NULL,
3023
    correlationstop timestamp with time zone
3022
    correlationstart date NOT NULL,
3023
    correlationstop date
3024 3024
);
3025 3025

  
3026 3026

  
......
3122 3122
    taxonconceptstatus text DEFAULT 'undetermined'::text NOT NULL,
3123 3123
    reference_id integer,
3124 3124
    plantpartycomments text,
3125
    startdate timestamp with time zone,
3126
    stopdate timestamp with time zone,
3125
    startdate date,
3126
    stopdate date,
3127 3127
    accessioncode text
3128 3128
);
3129 3129

  
......
3160 3160
    acceptedsynonym text,
3161 3161
    party_id integer,
3162 3162
    taxonstatus_id integer,
3163
    usagestart timestamp with time zone,
3164
    usagestop timestamp with time zone
3163
    usagestart date,
3164
    usagestop date
3165 3165
);
3166 3166

  
3167 3167

  
......
4422 4422
-- Name: locationevent_unique_within_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4423 4423
--
4424 4424

  
4425
CREATE UNIQUE INDEX locationevent_unique_within_location ON locationevent USING btree (location_id, (COALESCE(authoreventcode, '\\N'::text)), (COALESCE(obsstartdate, 'infinity'::timestamp with time zone))) WHERE ((parent_id IS NULL) AND (sourceaccessioncode IS NULL));
4425
CREATE UNIQUE INDEX locationevent_unique_within_location ON locationevent USING btree (location_id, (COALESCE(authoreventcode, '\\N'::text)), (COALESCE(obsstartdate, 'infinity'::date))) WHERE ((parent_id IS NULL) AND (sourceaccessioncode IS NULL));
4426 4426

  
4427 4427

  
4428 4428
--
......
4443 4443
-- Name: locationevent_unique_within_project; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4444 4444
--
4445 4445

  
4446
CREATE UNIQUE INDEX locationevent_unique_within_project ON locationevent USING btree ((COALESCE(project_id, 2147483647)), (COALESCE(authoreventcode, '\\N'::text)), (COALESCE(obsstartdate, 'infinity'::timestamp with time zone))) WHERE ((((parent_id IS NULL) AND (project_id IS NOT NULL)) AND (authoreventcode IS NOT NULL)) AND (obsstartdate IS NOT NULL));
4446
CREATE UNIQUE INDEX locationevent_unique_within_project ON locationevent USING btree ((COALESCE(project_id, 2147483647)), (COALESCE(authoreventcode, '\\N'::text)), (COALESCE(obsstartdate, 'infinity'::date))) WHERE ((((parent_id IS NULL) AND (project_id IS NOT NULL)) AND (authoreventcode IS NOT NULL)) AND (obsstartdate IS NOT NULL));
4447 4447

  
4448 4448

  
4449 4449
--
......
4555 4555
-- Name: project_unique_name_date; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4556 4556
--
4557 4557

  
4558
CREATE UNIQUE INDEX project_unique_name_date ON project USING btree (creator_id, (COALESCE(projectname, '\\N'::text)), (COALESCE(startdate, 'infinity'::timestamp with time zone))) WHERE (sourceaccessioncode IS NULL);
4558
CREATE UNIQUE INDEX project_unique_name_date ON project USING btree (creator_id, (COALESCE(projectname, '\\N'::text)), (COALESCE(startdate, 'infinity'::date))) WHERE (sourceaccessioncode IS NULL);
4559 4559

  
4560 4560

  
4561 4561
--
......
4667 4667
-- Name: taxonconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4668 4668
--
4669 4669

  
4670
CREATE UNIQUE INDEX taxonconcept_unique ON taxonconcept USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonname, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(creationdate, 'infinity'::timestamp with time zone)), (COALESCE(identifyingtaxonomicname, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)));
4670
CREATE UNIQUE INDEX taxonconcept_unique ON taxonconcept USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonname, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(creationdate, 'infinity'::date)), (COALESCE(identifyingtaxonomicname, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)));
4671 4671

  
4672 4672

  
4673 4673
--

Also available in: Unified diff