Project

General

Profile

« Previous | Next » 

Revision 9483

Added by Jing Tao almost 9 years ago

Add a policy_id in the smReplicationPolicy table to help preserver the order of the nodes list.

View differences:

src/upgrade-db-to-2.6.0-oracle.sql
1

  
1 2
/*
3
 * Add a new column policy_id in the smReplicationPolicy table
4
 */
5
CREATE SEQUENCE policy_id_seq;
6
ALTER TABLE smReplicationPolicy ADD policy_id number(20);
7
CREATE TRIGGER smReplicationPolicy_before_insert
8
BEFORE INSERT ON smReplicationPolicy FOR EACH ROW
9
BEGIN
10
  SELECT policy_id_seq.nextval
11
    INTO :new.policy_id
12
    FROM dual;
13
END;
14
/
15
UPDATE smReplicationPolicy SET policy_id=policy_id_seq.nextval;
16

  
17
/*
2 18
 * update the database version
3 19
 */
4 20
UPDATE db_version SET status=0;
src/upgrade-db-to-2.6.0-postgres.sql
4 4
SELECT setval('xml_catalog_id_seq', (SELECT max(catalog_id) from xml_catalog));
5 5

  
6 6
/*
7
 * Add a new column policy_id in the smReplicationPolicy table
8
 */
9
CREATE SEQUENCE policy_id_seq;
10
ALTER TABLE smReplicationPolicy ADD COLUMN policy_id INT8 default nextval('policy_id_seq');
11
UPDATE smReplicationPolicy SET policy_id=nextval('policy_id_seq');
12

  
13
/*
7 14
 * update the database version
8 15
 */
9 16
UPDATE db_version SET status=0;
src/xmltables-oracle.sql
442 442
     FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
443 443
);
444 444

  
445

  
445 446
CREATE TABLE smReplicationPolicy (
447
    policy_id NUMBER(20),
446 448
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
447 449
	member_node VARCHAR(250),	 -- replication member node
448 450
	policy VARCHAR2(2000),	 -- the policy (preferred, blocked, etc...TBD)
......
450 452
		FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
451 453
);
452 454

  
455
CREATE SEQUENCE policy_id_seq;
456
CREATE TRIGGER smReplicationPolicy_before_insert
457
BEFORE INSERT ON smReplicationPolicy FOR EACH ROW
458
BEGIN
459
  SELECT policy_id_seq.nextval
460
    INTO :new.policy_id
461
    FROM dual;
462
END;
463
/
464

  
453 465
CREATE TABLE smReplicationStatus (
454 466
	guid VARCHAR2(2000),	-- the globally unique string identifier of the object that the system metadata describes
455 467
	member_node VARCHAR(250),	 -- replication member node
src/xmltables-postgres.sql
341 341
 * ALTER TABLE systemMetadata ADD COLUMN number_replicas INT8;
342 342
 */
343 343

  
344

  
344
CREATE SEQUENCE policy_id_seq;
345 345
CREATE TABLE smReplicationPolicy (
346
  policy_id INT8 default nextval('policy_id_seq'), 
346 347
	guid text,	-- the globally unique string identifier of the object that the system metadata describes
347 348
	member_node VARCHAR(250),	 -- replication member node
348 349
	policy text,	 -- the policy (preferred, blocked, etc...TBD)

Also available in: Unified diff