Project

General

Profile

« Previous | Next » 

Revision 1027

vegbien.sql: Removed methodtrait* tables and added first-class method attributes as first-class fields of method. Removed *method tables from the ERD that will be replaced by method.

View differences:

schemas/vegbien.my.sql
1261 1261
    reference_id int(11),
1262 1262
    name text NOT NULL,
1263 1263
    description text,
1264
    accessioncode text
1264
    accessioncode text,
1265
    mindiameter double precision,
1266
    minheight double precision,
1267
    maxdiameter double precision,
1268
    maxheight double precision,
1269
    observationtype text,
1270
    observationmeasure text,
1271
    observationmeasureunits text,
1272
    taxonclassincluded text,
1273
    taxonclassexcluded text
1265 1274
);
1266 1275

  
1267 1276

  
......
1279 1288

  
1280 1289

  
1281 1290

  
1282

  
1283

  
1284 1291
--
1285
-- Name: methodtrait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1286
--
1287

  
1288
CREATE TABLE methodtrait (
1289
    methodtrait_id int(11) NOT NULL,
1290
    method_id int(11) NOT NULL,
1291
    methodtraitname_id int(11) NOT NULL,
1292
    value text NOT NULL
1293
);
1294

  
1295

  
1296
--
1297
-- Name: methodtrait_methodtrait_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1298
--
1299

  
1300

  
1301

  
1302

  
1303
--
1304
-- Name: methodtrait_methodtrait_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1305
--
1306

  
1307

  
1308

  
1309

  
1310
--
1311
-- Name: methodtraitname; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1312
--
1313

  
1314
CREATE TABLE methodtraitname (
1315
    methodtraitname_id int(11) NOT NULL,
1316
    name text NOT NULL,
1317
    appliesto text NOT NULL
1318
);
1319

  
1320

  
1321
--
1322
-- Name: methodtraitname_methodtraitname_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1323
--
1324

  
1325

  
1326

  
1327

  
1328
--
1329
-- Name: methodtraitname_methodtraitname_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1330
--
1331

  
1332

  
1333

  
1334

  
1335

  
1336

  
1337
--
1338 1292
-- Name: namedplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1339 1293
--
1340 1294

  
......
3272 3226

  
3273 3227

  
3274 3228
--
3275
-- Name: methodtrait_id; Type: DEFAULT; Schema: public; Owner: -
3276
--
3277

  
3278

  
3279

  
3280

  
3281
--
3282
-- Name: methodtraitname_id; Type: DEFAULT; Schema: public; Owner: -
3283
--
3284

  
3285

  
3286

  
3287

  
3288
--
3289 3229
-- Name: namedplace_id; Type: DEFAULT; Schema: public; Owner: -
3290 3230
--
3291 3231

  
......
4009 3949

  
4010 3950

  
4011 3951
--
4012
-- Name: methodtrait_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4013
--
4014

  
4015
ALTER TABLE methodtrait
4016
    ADD CONSTRAINT methodtrait_keys UNIQUE (method_id, methodtraitname_id);
4017

  
4018

  
4019
--
4020
-- Name: methodtrait_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4021
--
4022

  
4023
ALTER TABLE methodtrait
4024
    ADD CONSTRAINT methodtrait_pkey PRIMARY KEY (methodtrait_id);
4025

  
4026

  
4027
--
4028
-- Name: methodtraitname_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4029
--
4030

  
4031
ALTER TABLE methodtraitname
4032
    ADD CONSTRAINT methodtraitname_keys UNIQUE (name);
4033

  
4034

  
4035
--
4036
-- Name: methodtraitname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4037
--
4038

  
4039
ALTER TABLE methodtraitname
4040
    ADD CONSTRAINT methodtraitname_pkey PRIMARY KEY (methodtraitname_id);
4041

  
4042

  
4043
--
4044 3952
-- Name: namedplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4045 3953
--
4046 3954

  
......
4974 4882

  
4975 4883

  
4976 4884
--
4977
-- Name: fki_methodtrait_method_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4978
--
4979

  
4980
CREATE INDEX fki_methodtrait_method_id ON methodtrait  (method_id);
4981

  
4982

  
4983
--
4984
-- Name: fki_methodtrait_methodtraitname_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4985
--
4986

  
4987
CREATE INDEX fki_methodtrait_methodtraitname_id ON methodtrait  (methodtraitname_id);
4988

  
4989

  
4990
--
4991 4885
-- Name: fki_plantconcept_scope_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4992 4886
--
4993 4887

  
......
6317 6211

  
6318 6212

  
6319 6213
--
6320
-- Name: methodtrait_method_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6321
--
6322

  
6323
ALTER TABLE methodtrait
6324
    ADD CONSTRAINT methodtrait_method_id FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
6325

  
6326

  
6327
--
6328
-- Name: methodtrait_methodtraitname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6329
--
6330

  
6331
ALTER TABLE methodtrait
6332
    ADD CONSTRAINT methodtrait_methodtraitname_id FOREIGN KEY (methodtraitname_id) REFERENCES methodtraitname(methodtraitname_id) ON UPDATE CASCADE ON DELETE CASCADE;
6333

  
6334

  
6335
--
6336 6214
-- Name: namedplace_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6337 6215
--
6338 6216

  
schemas/vegbien_empty.sql
35 35
TRUNCATE locationeventcontributor CASCADE;
36 36
TRUNCATE locationeventsynonym CASCADE;
37 37
TRUNCATE method CASCADE;
38
TRUNCATE methodtrait CASCADE;
39
TRUNCATE methodtraitname CASCADE;
40 38
TRUNCATE namedplace CASCADE;
41 39
TRUNCATE namedplacecorrelation CASCADE;
42 40
TRUNCATE note CASCADE;
schemas/vegbien.sql
1450 1450
    reference_id integer,
1451 1451
    name text NOT NULL,
1452 1452
    description text,
1453
    accessioncode text
1453
    accessioncode text,
1454
    mindiameter double precision,
1455
    minheight double precision,
1456
    maxdiameter double precision,
1457
    maxheight double precision,
1458
    observationtype text,
1459
    observationmeasure text,
1460
    observationmeasureunits text,
1461
    taxonclassincluded text,
1462
    taxonclassexcluded text
1454 1463
);
1455 1464

  
1456 1465

  
......
1473 1482
ALTER SEQUENCE method_method_id_seq OWNED BY method.method_id;
1474 1483

  
1475 1484

  
1476
SET default_with_oids = false;
1477

  
1478 1485
--
1479
-- Name: methodtrait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1480
--
1481

  
1482
CREATE TABLE methodtrait (
1483
    methodtrait_id integer NOT NULL,
1484
    method_id integer NOT NULL,
1485
    methodtraitname_id integer NOT NULL,
1486
    value text NOT NULL
1487
);
1488

  
1489

  
1490
--
1491
-- Name: methodtrait_methodtrait_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1492
--
1493

  
1494
CREATE SEQUENCE methodtrait_methodtrait_id_seq
1495
    START WITH 1
1496
    INCREMENT BY 1
1497
    NO MINVALUE
1498
    NO MAXVALUE
1499
    CACHE 1;
1500

  
1501

  
1502
--
1503
-- Name: methodtrait_methodtrait_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1504
--
1505

  
1506
ALTER SEQUENCE methodtrait_methodtrait_id_seq OWNED BY methodtrait.methodtrait_id;
1507

  
1508

  
1509
--
1510
-- Name: methodtraitname; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1511
--
1512

  
1513
CREATE TABLE methodtraitname (
1514
    methodtraitname_id integer NOT NULL,
1515
    name text NOT NULL,
1516
    appliesto methodtraitname_appliesto[] NOT NULL
1517
);
1518

  
1519

  
1520
--
1521
-- Name: methodtraitname_methodtraitname_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1522
--
1523

  
1524
CREATE SEQUENCE methodtraitname_methodtraitname_id_seq
1525
    START WITH 1
1526
    INCREMENT BY 1
1527
    NO MINVALUE
1528
    NO MAXVALUE
1529
    CACHE 1;
1530

  
1531

  
1532
--
1533
-- Name: methodtraitname_methodtraitname_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1534
--
1535

  
1536
ALTER SEQUENCE methodtraitname_methodtraitname_id_seq OWNED BY methodtraitname.methodtraitname_id;
1537

  
1538

  
1539
SET default_with_oids = true;
1540

  
1541
--
1542 1486
-- Name: namedplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1543 1487
--
1544 1488

  
......
3741 3685

  
3742 3686

  
3743 3687
--
3744
-- Name: methodtrait_id; Type: DEFAULT; Schema: public; Owner: -
3745
--
3746

  
3747
ALTER TABLE methodtrait ALTER COLUMN methodtrait_id SET DEFAULT nextval('methodtrait_methodtrait_id_seq'::regclass);
3748

  
3749

  
3750
--
3751
-- Name: methodtraitname_id; Type: DEFAULT; Schema: public; Owner: -
3752
--
3753

  
3754
ALTER TABLE methodtraitname ALTER COLUMN methodtraitname_id SET DEFAULT nextval('methodtraitname_methodtraitname_id_seq'::regclass);
3755

  
3756

  
3757
--
3758 3688
-- Name: namedplace_id; Type: DEFAULT; Schema: public; Owner: -
3759 3689
--
3760 3690

  
......
4478 4408

  
4479 4409

  
4480 4410
--
4481
-- Name: methodtrait_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4482
--
4483

  
4484
ALTER TABLE ONLY methodtrait
4485
    ADD CONSTRAINT methodtrait_keys UNIQUE (method_id, methodtraitname_id);
4486

  
4487

  
4488
--
4489
-- Name: methodtrait_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4490
--
4491

  
4492
ALTER TABLE ONLY methodtrait
4493
    ADD CONSTRAINT methodtrait_pkey PRIMARY KEY (methodtrait_id);
4494

  
4495

  
4496
--
4497
-- Name: methodtraitname_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4498
--
4499

  
4500
ALTER TABLE ONLY methodtraitname
4501
    ADD CONSTRAINT methodtraitname_keys UNIQUE (name);
4502

  
4503

  
4504
--
4505
-- Name: methodtraitname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4506
--
4507

  
4508
ALTER TABLE ONLY methodtraitname
4509
    ADD CONSTRAINT methodtraitname_pkey PRIMARY KEY (methodtraitname_id);
4510

  
4511

  
4512
--
4513 4411
-- Name: namedplace_keys; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4514 4412
--
4515 4413

  
......
5443 5341

  
5444 5342

  
5445 5343
--
5446
-- Name: fki_methodtrait_method_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5447
--
5448

  
5449
CREATE INDEX fki_methodtrait_method_id ON methodtrait USING btree (method_id);
5450

  
5451

  
5452
--
5453
-- Name: fki_methodtrait_methodtraitname_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5454
--
5455

  
5456
CREATE INDEX fki_methodtrait_methodtraitname_id ON methodtrait USING btree (methodtraitname_id);
5457

  
5458

  
5459
--
5460 5344
-- Name: fki_plantconcept_scope_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5461 5345
--
5462 5346

  
......
6800 6684

  
6801 6685

  
6802 6686
--
6803
-- Name: methodtrait_method_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6804
--
6805

  
6806
ALTER TABLE ONLY methodtrait
6807
    ADD CONSTRAINT methodtrait_method_id FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;
6808

  
6809

  
6810
--
6811
-- Name: methodtrait_methodtraitname_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6812
--
6813

  
6814
ALTER TABLE ONLY methodtrait
6815
    ADD CONSTRAINT methodtrait_methodtraitname_id FOREIGN KEY (methodtraitname_id) REFERENCES methodtraitname(methodtraitname_id) ON UPDATE CASCADE ON DELETE CASCADE;
6816

  
6817

  
6818
--
6819 6687
-- Name: namedplace_reference_id; Type: FK CONSTRAINT; Schema: public; Owner: -
6820 6688
--
6821 6689

  

Also available in: Unified diff