1 -- Apply Dan Wells' changes to the serial schema, from the
2 -- seials-integration branch
6 INSERT INTO config.upgrade_log (version) VALUES ('0352'); -- Scott McKellar
8 CREATE TABLE serial.subscription_note (
10 subscription INT NOT NULL
11 REFERENCES serial.subscription (id)
13 DEFERRABLE INITIALLY DEFERRED,
15 REFERENCES actor.usr (id)
16 DEFERRABLE INITIALLY DEFERRED,
17 create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
18 pub BOOL NOT NULL DEFAULT FALSE,
23 ALTER TABLE serial.caption_and_pattern
24 RENAME COLUMN create_time TO create_date;
26 ALTER TABLE serial.distribution
27 RENAME COLUMN unit_label_base TO unit_label_prefix;
29 CREATE TABLE serial.distribution_note (
30 id SERIAL PRIMARY KEY,
31 distribution INT NOT NULL
32 REFERENCES serial.distribution (id)
34 DEFERRABLE INITIALLY DEFERRED,
36 REFERENCES actor.usr (id)
37 DEFERRABLE INITIALLY DEFERRED,
38 create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
39 pub BOOL NOT NULL DEFAULT FALSE,
44 ALTER TABLE serial.issuance
45 ADD COLUMN caption_and_pattern INT REFERENCES serial.caption_and_pattern (id)
46 DEFERRABLE INITIALLY DEFERRED;
47 ------- Begin surgery on serial.unit
49 ALTER TABLE serial.unit
52 ALTER TABLE serial.unit
53 RENAME COLUMN label_sort_key TO sort_key;
55 ALTER TABLE serial.unit
56 RENAME COLUMN contents TO detailed_contents;
58 ALTER TABLE serial.unit
59 ADD COLUMN summary_contents TEXT;
62 SET summary_contents = detailed_contents;
64 ALTER TABLE serial.unit
65 ALTER column summary_contents SET NOT NULL;
67 ------- End surgery on serial.unit
69 ALTER TABLE serial.item
70 ADD COLUMN status TEXT CONSTRAINT value_status_check CHECK (
71 status IN ( 'Bindery', 'Bound', 'Claimed', 'Discarded',
72 'Expected', 'Not Held', 'Not Published', 'Received'))
74 ADD COLUMN shadowed BOOL NOT NULL DEFAULT FALSE;
76 ALTER TABLE serial.bib_summary RENAME TO basic_summary;
78 ALTER TABLE serial.sup_summary RENAME TO supplement_summary;