Subject | RE: [firebird-support] Re: How to update table structure with SQL? |
---|---|
Author | Maya Opperman |
Post date | 2009-06-23T06:56:41Z |
>--- In firebird-support@yahoogroups.com, "neighbour.kerry" <kerry@...>wrote:
>After a bit of searching in this forum, I may have come up with analternative.
>- Rename the existing DBmight be easier that trying to get the CREATE/ALTER stuff to work.
>- Create a new DB with the updated DDL script
>- data pump all the data across from the original database
>Mind you, I still have to write the data pump, but that looks like it
Ouch. I just use an IBSQL (or an FIBSQL now) to call
Alter table xyz add NewField TheType;
I then ignore any errors RE the field already existing.
Then later:
Update xyz set NewField = 'default data' where NewField is null;
I should probably be checking for existence first, but so far this has
worked perfectly.
Also, I use my update program to add the changes, not a third party DB
tool, so I don't have to remember later to put all the changes into the
update source.
Before making any changes though, I drop all stored procedures, and put
them all back at the end with one big script generated by IBExtract.
I'd like to know if there are any issues to this approach, but so far it
has served me well, and we are on release number 56 of the database now.