Project

General

Profile

« Previous | Next » 

Revision 8938

bin/my2pg: unpack custom types set('...')

View differences:

schemas/VegCore/VegCore.pg.sql
20 20
CREATE TABLE "aggregate_observation" (
21 21
  "id" bytea NOT NULL,
22 22
  "taxon_concept" bytea NOT NULL,
23
  "traits" set('hstore') DEFAULT NULL,
23
  "traits" hstore DEFAULT NULL,
24 24
  PRIMARY KEY ("id"),
25 25
  /*KEY "fk_aggregate_observation_taxon_name1_idx" ("taxon_concept")*/CHECK (true),
26 26
  /*CONSTRAINT "fk_aggregate_observation_taxon_name1" FOREIGN KEY ("taxon_concept") REFERENCES "taxon_concept" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
......
87 87
CREATE TABLE "community" (
88 88
  "id" bytea NOT NULL,
89 89
  "name" bytea NOT NULL,
90
  "info" set('hstore') DEFAULT NULL,
90
  "info" hstore DEFAULT NULL,
91 91
  PRIMARY KEY ("id"),
92 92
  /*CONSTRAINT "fk_community_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
93 93
);
......
196 196
CREATE TABLE "geological_context" (
197 197
  "id" bytea NOT NULL,
198 198
  "name" bytea NOT NULL,
199
  "info" set('hstore') DEFAULT NULL,
199
  "info" hstore DEFAULT NULL,
200 200
  PRIMARY KEY ("id"),
201 201
  /*CONSTRAINT "fk_geological_context_record1" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
202 202
);
......
217 217
  "id" bytea NOT NULL,
218 218
  "geovalid" integer NOT NULL,
219 219
  "lat_long_domain_valid" integer NOT NULL,
220
  "lat_long_in_ranks" set('hstore') DEFAULT NULL,
220
  "lat_long_in_ranks" hstore DEFAULT NULL,
221 221
  PRIMARY KEY ("id"),
222 222
  /*CONSTRAINT "fk_geovalidation_validatable_place1" FOREIGN KEY ("id") REFERENCES "validatable_place" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
223 223
);
......
257 257
  "id" bytea NOT NULL,
258 258
  "individual" bytea DEFAULT NULL,
259 259
  "code" bytea DEFAULT NULL,
260
  "traits" set('hstore') DEFAULT NULL,
260
  "traits" hstore DEFAULT NULL,
261 261
  PRIMARY KEY ("id"),
262 262
  /*KEY "fk_individual_observation_individual1_idx" ("individual")*/CHECK (true),
263 263
  /*CONSTRAINT "fk_individual_observation_individual1" FOREIGN KEY ("individual") REFERENCES "individual" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
......
279 279
CREATE TABLE "method" (
280 280
  "id" bytea NOT NULL,
281 281
  "parent" bytea NOT NULL,
282
  "info" set('hstore') DEFAULT NULL,
282
  "info" hstore DEFAULT NULL,
283 283
  PRIMARY KEY ("id"),
284 284
  /*KEY "fk_method_method1_idx" ("parent")*/CHECK (true),
285 285
  /*CONSTRAINT "fk_method_method1" FOREIGN KEY ("parent") REFERENCES "method" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
......
300 300
DROP TABLE IF EXISTS "organization";
301 301
CREATE TABLE "organization" (
302 302
  "id" bytea NOT NULL,
303
  "info" set('hstore') DEFAULT NULL,
303
  "info" hstore DEFAULT NULL,
304 304
  PRIMARY KEY ("id"),
305 305
  /*CONSTRAINT "fk_organization_party1" FOREIGN KEY ("id") REFERENCES "party" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
306 306
);
......
321 321
  "id" bytea NOT NULL,
322 322
  "matched_taxon_concept" bytea DEFAULT NULL,
323 323
  "match_score" float DEFAULT NULL,
324
  "match_info" set('hstore') DEFAULT NULL,
324
  "match_info" hstore DEFAULT NULL,
325 325
  PRIMARY KEY ("id"),
326 326
  /*KEY "fk_parsed_taxon_assertion_taxon_name1_idx" ("matched_taxon_concept")*/CHECK (true),
327 327
  /*CONSTRAINT "fk_matched_taxon_qualified_taxon10" FOREIGN KEY ("id") REFERENCES "taxon_assertion" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
......
342 342
DROP TABLE IF EXISTS "party";
343 343
CREATE TABLE "party" (
344 344
  "id" bytea NOT NULL,
345
  "info" set('hstore') DEFAULT NULL,
345
  "info" hstore DEFAULT NULL,
346 346
  PRIMARY KEY ("id"),
347 347
  /*CONSTRAINT "fk_collection_source10" FOREIGN KEY ("id") REFERENCES "record" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
348 348
);
......
395 395
  "slope_direction_deg_N" double precision DEFAULT NULL,
396 396
  "geological_context" bytea DEFAULT NULL,
397 397
  "community" bytea DEFAULT NULL,
398
  "observations" set('hstore') DEFAULT NULL,
398
  "observations" hstore DEFAULT NULL,
399 399
  PRIMARY KEY ("id"),
400 400
  /*KEY "fk_place_observation_place1_idx" ("place")*/CHECK (true),
401 401
  /*KEY "fk_place_observation_geological_context1_idx" ("geological_context")*/CHECK (true),
......
426 426
  "state_province" bytea DEFAULT NULL,
427 427
  "county" bytea DEFAULT NULL,
428 428
  "municipality" bytea DEFAULT NULL,
429
  "ranks" set('hstore') DEFAULT NULL,
429
  "ranks" hstore DEFAULT NULL,
430 430
  PRIMARY KEY ("id")
431 431
);
432 432

  
......
466 466
CREATE TABLE "project" (
467 467
  "id" bytea NOT NULL,
468 468
  "name" bytea NOT NULL,
469
  "info" set('hstore') DEFAULT NULL,
469
  "info" hstore DEFAULT NULL,
470 470
  PRIMARY KEY ("id"),
471 471
  /*CONSTRAINT "fk_project_event1" FOREIGN KEY ("id") REFERENCES "event" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
472 472
);
......
488 488
  "source" bytea NOT NULL,
489 489
  "source_id_scope" bytea DEFAULT NULL,
490 490
  "source_record_id" bytea DEFAULT NULL,
491
  "info" set('hstore') DEFAULT NULL,
491
  "info" hstore DEFAULT NULL,
492 492
  PRIMARY KEY ("id"),
493 493
  /*CONSTRAINT "record_unique" */UNIQUE ("source","source_id_scope","source_record_id"),
494 494
  /*KEY "fk_record_source1_idx" ("source")*/CHECK (true),
......
529 529
  "id" bytea NOT NULL,
530 530
  "record" bytea NOT NULL,
531 531
  "related_record" bytea NOT NULL,
532
  "info" set('hstore') DEFAULT NULL,
532
  "info" hstore DEFAULT NULL,
533 533
  PRIMARY KEY ("id"),
534 534
  /*KEY "fk_relationship_record1_idx" ("record")*/CHECK (true),
535 535
  /*KEY "fk_relationship_related_record_idx" ("related_record")*/CHECK (true),
......
552 552
DROP TABLE IF EXISTS "soil_observation";
553 553
CREATE TABLE "soil_observation" (
554 554
  "id" bytea NOT NULL,
555
  "observations" set('hstore') DEFAULT NULL,
555
  "observations" hstore DEFAULT NULL,
556 556
  PRIMARY KEY ("id"),
557 557
  /*CONSTRAINT "fk_soil_observation_place_observation1" FOREIGN KEY ("id") REFERENCES "place_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
558 558
);
......
575 575
  "name" bytea NOT NULL,
576 576
  "first_publisher" bytea DEFAULT NULL,
577 577
  "owner" bytea DEFAULT NULL,
578
  "info" set('hstore') DEFAULT NULL,
578
  "info" hstore DEFAULT NULL,
579 579
  PRIMARY KEY ("id"),
580 580
  /*CONSTRAINT "source_unique" */UNIQUE ("parent","name"),
581 581
  /*KEY "fk_source1_idx" ("parent")*/CHECK (true),
......
641 641
CREATE TABLE "specimen_observation" (
642 642
  "id" bytea NOT NULL,
643 643
  "specimen" bytea NOT NULL,
644
  "traits" set('hstore') DEFAULT NULL,
644
  "traits" hstore DEFAULT NULL,
645 645
  PRIMARY KEY ("id"),
646 646
  /*KEY "fk_specimen_observation_specimen1_idx" ("specimen")*/CHECK (true),
647 647
  /*CONSTRAINT "fk_specimen_observation_specimen1" FOREIGN KEY ("specimen") REFERENCES "specimen" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
......
685 685
  "id" bytea NOT NULL,
686 686
  "individual_observation" bytea NOT NULL,
687 687
  "stem" bytea DEFAULT NULL,
688
  "traits" set('hstore') DEFAULT NULL,
688
  "traits" hstore DEFAULT NULL,
689 689
  PRIMARY KEY ("id"),
690 690
  /*CONSTRAINT "stem_observation_unique" */UNIQUE ("individual_observation","stem"),
691 691
  /*KEY "fk_stem_observation_individual_observation1_idx" ("individual_observation")*/CHECK (true),
......
710 710
CREATE TABLE "stratum" (
711 711
  "id" bytea NOT NULL,
712 712
  "name" bytea NOT NULL,
713
  "info" set('hstore') DEFAULT NULL,
713
  "info" hstore DEFAULT NULL,
714 714
  PRIMARY KEY ("id"),
715 715
  /*CONSTRAINT "fk_place_path_record10" FOREIGN KEY ("id") REFERENCES "method" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
716 716
);
......
752 752
  "string" bytea NOT NULL,
753 753
  "taxon" bytea DEFAULT NULL,
754 754
  "cf_aff" bytea DEFAULT NULL,
755
  "annotations" set('hstore') DEFAULT NULL,
755
  "annotations" hstore DEFAULT NULL,
756 756
  PRIMARY KEY ("id"),
757 757
  /*KEY "fk_taxon_assertion_taxon_string1_idx" ("string")*/CHECK (true),
758 758
  /*KEY "fk_taxon_assertion_taxon_name1_idx" ("taxon")*/CHECK (true),
......
805 805
  "id" bytea NOT NULL,
806 806
  "taxon_assertion" bytea NOT NULL,
807 807
  "identified_by" bytea DEFAULT NULL,
808
  "fit_info" set('hstore') DEFAULT NULL,
808
  "fit_info" hstore DEFAULT NULL,
809 809
  PRIMARY KEY ("id"),
810 810
  /*CONSTRAINT "taxon_determination_unique" */UNIQUE ("taxon_assertion","identified_by"),
811 811
  /*KEY "fk_taxon_occurrence_has_qualified_taxon1_idx" ("taxon_assertion")*/CHECK (true),
......
861 861
  "voucher" bytea DEFAULT NULL,
862 862
  "growth_form" bytea DEFAULT NULL,
863 863
  "cultivated" integer DEFAULT NULL,
864
  "traits" set('hstore') DEFAULT NULL,
864
  "traits" hstore DEFAULT NULL,
865 865
  PRIMARY KEY ("id"),
866 866
  /*KEY "fk_taxon_observation_taxon_occurrence2_idx" ("taxon_occurrence")*/CHECK (true),
867 867
  /*KEY "fk_taxon_observation_specimen1_idx" ("voucher")*/CHECK (true),
......
913 913
  "family" bytea DEFAULT NULL,
914 914
  "genus" bytea DEFAULT NULL,
915 915
  "specific_epithet" bytea DEFAULT NULL,
916
  "ranks" set('hstore') DEFAULT NULL,
916
  "ranks" hstore DEFAULT NULL,
917 917
  PRIMARY KEY ("id"),
918 918
  /*CONSTRAINT "fk_taxon_path_taxon_name1" FOREIGN KEY ("id") REFERENCES "taxon_name" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true)
919 919
);
......
933 933
CREATE TABLE "taxon_presence" (
934 934
  "id" bytea NOT NULL,
935 935
  "taxon_concept" bytea NOT NULL,
936
  "traits" set('hstore') DEFAULT NULL,
936
  "traits" hstore DEFAULT NULL,
937 937
  PRIMARY KEY ("id"),
938 938
  /*KEY "fk_taxon_presence_taxon_name1_idx" ("taxon_concept")*/CHECK (true),
939 939
  /*CONSTRAINT "fk_taxon_observation_taxon_occurrence1" FOREIGN KEY ("id") REFERENCES "taxon_observation" ("id") ON DELETE CASCADE ON UPDATE CASCADE*/CHECK (true),
bin/my2pg
25 25
-e 's/ (char)\(0\)/ \1/g' \
26 26
-e 's/ datetime/ timestamp/g' \
27 27
-e 's/ ("[^"]*") enum(\([^()]*\))/ \1 text CHECK (\1 in \2)/g' \
28
-e "s/ set\('([^()]*)'\)/ \1/g" \
28 29
"$@"\
29 30
|"$selfDir/my2pg.data"

Also available in: Unified diff