Subject | Re: [IBO] Prepare to Replication |
---|---|
Author | Helen Borrie |
Post date | 2003-10-30T11:54:44Z |
At 11:16 AM 30/10/2003 +0000, you wrote:
You are going to need to write a script to do this job. IBO has TIB_Script
that you can use for your application, once you have written and tested
your script.
These are not trivial metadata changes so you have to plan for the script
to be run when the application is a) the only connection to the database
and b) logged in as SYSDBA.
The actual steps your script has to take to kill keys are an off-topic
topic for IBO. In brief (committing each statement as it goes along), it
must first remove all dependencies on all keys, dropping the foreign keys
first and the PKs and UNIQUE constraints next; then do an ALTER TABLE XYZ
ADD Site_ID... to each table, then UPDATE XYZ SET SiteID =
something; then, add the new PK constraints; then, finally, add the new
FK constraints.
For more help on the DDL, please ask in firebird-support. Ask *here* about
the IBO side of things.
Helen
>I want to create a tool what prepare databases to replication.Those classes are for extracting metadata from a database.
>
>It is create triggers/procedures/tables/etc for replication.
>
>But I have a problem with primary key modification.
>
>The tables have an ID field, an unique ID -> the primary key.
>
>I want to chahge the constraint to containing the new field names
>REPL_SITE_ID.
>
>Every site have an SITE_ID, and if the generators are produced same
>value to ID, the SITE_ID avoid the collisions.
>
>In IBO help I see the definitions of IB_DDL classes, but I cannot see
>any examples for I see, how to write a code to replace the constraint.
You are going to need to write a script to do this job. IBO has TIB_Script
that you can use for your application, once you have written and tested
your script.
These are not trivial metadata changes so you have to plan for the script
to be run when the application is a) the only connection to the database
and b) logged in as SYSDBA.
The actual steps your script has to take to kill keys are an off-topic
topic for IBO. In brief (committing each statement as it goes along), it
must first remove all dependencies on all keys, dropping the foreign keys
first and the PKs and UNIQUE constraints next; then do an ALTER TABLE XYZ
ADD Site_ID... to each table, then UPDATE XYZ SET SiteID =
something; then, add the new PK constraints; then, finally, add the new
FK constraints.
For more help on the DDL, please ask in firebird-support. Ask *here* about
the IBO side of things.
Helen