Jeff Amiel jamiel
Mon Aug 30 16:35:58 PDT 2004
I am attempting to put together a set of procedures (for in-house use) 
for ensuring that schema changes get the correct attention from my slony 
replication scheme.
I would appreciate some input as to how these tasks 'should' be 
performed.  (much of the information below came from recent posts on the 
subject....)


Adding a new table/sequence
----------------------

Create a new set with the new table.
Subscribe the same slave nodes to the new set that are subscribed to the
old set.
Wait for the subscribe to complete on the slave nodes.
Execute the slonik MERGE SET command to merge the new set with the
existing set.


removing a table/sequence
--------------------------
drop current set (which will unsubscribe all nodes)
create new set (without table you want removed)
subscribe all appropriate nodes to it.


Adding/Removing a column to a replicated table
-------------------------------------------------

create one file with appropriate SQL

example: 
alter table blah add column new_column type;
alter table blah alter column new_column set default good_default;
update blah set new_column = good_default where new_column is null;
alter table blah alter column new_column set not null;

Execute a slonik script that executes those commands (via slonik EXECUTE SCRIPT)
(This will all be done in the correct order for the replication, not
interfering with other writes that may happen.)

















More information about the Slony1-general mailing list