annotate db/to_idavoll_0.8.sql @ 206:274a45d2a5ab

Implement root collection that includes all leaf nodes.
author Ralph Meijer <ralphm@ik.nu>
date Mon, 04 Aug 2008 13:47:10 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
206
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
1 ALTER TABLE affiliations RENAME id TO affiliation_id;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
2
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
3 ALTER TABLE entities RENAME id TO entity_id;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
4
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5 ALTER TABLE items RENAME id TO item_id;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
6
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
7 ALTER TABLE nodes RENAME id TO node_id;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
8 ALTER TABLE nodes RENAME persistent to persist_items;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
9 ALTER TABLE nodes RENAME deliver_payload to deliver_payloads;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
10 ALTER TABLE nodes ADD COLUMN node_type text;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
11 ALTER TABLE nodes ALTER COLUMN node_type SET DEFAULT 'leaf';
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
12 UPDATE nodes SET node_type = 'leaf';
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
13 ALTER TABLE nodes ALTER COLUMN node_type SET NOT NULL;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
14 ALTER TABLE nodes ADD CHECK (node_type IN ('leaf', 'collection'));
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
15 ALTER TABLE nodes ALTER COLUMN persistent DROP NOT NULL;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
16 ALTER TABLE nodes ALTER COLUMN persistent DROP DEFAULT;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
17
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
18 ALTER TABLE subscriptions RENAME id TO subscription_id;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
19 ALTER TABLE subscriptions RENAME subscription TO state;
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
20 ALTER TABLE subscriptions ADD COLUMN subscription_type text
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
21 CHECK (subscription_type IN (NULL, 'items', 'nodes'));
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
22 ALTER TABLE subscriptions ADD COLUMN subscription_depth text
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
23 CHECK (subscription_depth IN (NULL, '1', 'all'));
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
24
274a45d2a5ab Implement root collection that includes all leaf nodes.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
25 INSERT INTO nodes (node, node_type) values ('', 'collection');