On Wednesday 12 September 2007 01:30:26 iain duncan wrote:
>
> So it would:
> - lock out hits ( lots of ways of doing that, mod_rewrite can be used to
> make a user spin for a second )
> - dump your table with full column names to an sql file
> - drop the table
> - run tg-admin sql create to make a new table
> - refill the table
> - unlock your blocker

Unfortunately this only works with simple databases.  If you have a lot of 
FKs, VIEWs, stored procedures / functions, indices, partial indices, etc. 
working with the table you want to change you have to either drop all of them 
and recreate all of them or you have to find another way to change your 
design.

I still believe that issuing DDL commands are much easier and faster.  For 
example, to add a new integer column you just issue an "ALTER TABLE xyz ADD 
COLUMN abc INTEGER" command and that's done.  Zero downtime, referential 
integrity maintained, no need to reindex the table, restore views, 
functions / stored procedures, etc. and the bigger benefit: no risk to loose 
your data.

You can also check if your database server can do DDL changes inside a 
transaction.  If it does, then you can get very fancy on your changes and if 
you do something wrong just "ROLLBACK" instead of "COMMIT".



-- 
Jorge Godoy      <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to