Subject | RE: [firebird-support] Upgrade table structure |
---|---|
Author | Graeme Edwards |
Post date | 2005-06-29T01:31:36Z |
Hi,
We do a similar thing to Gustavo. We have a bootstrap file which holds the
database DDL and DML commands
which are processed by the application on startup.
We use line numbers and store the last updated script line number in the
database so that theoretically
upgrades from any previous version know which updates they have done and
which ones they haven't.
There are of course going to be problems when certain lines fail for
whatever reason, but we have an inbuilt
mechanism which allows the customer to email their upgrade log to us when
errors occur. This means
that we can evaluate how to correct the upgrade errors and then advise
them.
ALTER TABLE <TABLE> ALTER <FIELD> TYPE <NEWFIELDTYPE>
This is the syntax for changing a field type.
Graeme Edwards
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Robert martin
Sent: Wednesday, 29 June 2005 9:54 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Upgrade table structure
Hi
We have a similar situation, every time our app is upgraded the DB
structure changes. I just know Im going to get lots of flames for this
but this is what we do......
(all automated)
If the system detects the DB structure is old we
Backup DB (in case of problems).
Build a new empty DB
Pump (using IBO pump) data from the old DB to the new DB
This gives us MANY advantages over a modify script.
1. Dead simple to maintain. No need to maintain modify DB statements.
This is especially useful as our clients are likely to skip one or more
updates.
2. Can add /delete / modify fields, triggers, procedures etc without
worrying about dependencies
Downsides
1. Slow (for a half gig DB this can take 20+ minutes). This is negated
by the fact that our updates only take place a relatively small number
of times a year.
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
Gustavo wrote:
structure of some tables. What I want to do is that my application could
automatically upgrade the table´s structures that changed.
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
_____
YAHOO! GROUPS LINKS
* Visit your group "firebird-support
<http://groups.yahoo.com/group/firebird-support> " on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
_____
[Non-text portions of this message have been removed]
We do a similar thing to Gustavo. We have a bootstrap file which holds the
database DDL and DML commands
which are processed by the application on startup.
We use line numbers and store the last updated script line number in the
database so that theoretically
upgrades from any previous version know which updates they have done and
which ones they haven't.
There are of course going to be problems when certain lines fail for
whatever reason, but we have an inbuilt
mechanism which allows the customer to email their upgrade log to us when
errors occur. This means
that we can evaluate how to correct the upgrade errors and then advise
them.
>A field has changed (length, etc.): I didn´t found a statement like ALTERFIELD so I though of modifying RDB$FIELDS with UPDATE statements.
ALTER TABLE <TABLE> ALTER <FIELD> TYPE <NEWFIELDTYPE>
This is the syntax for changing a field type.
Graeme Edwards
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Robert martin
Sent: Wednesday, 29 June 2005 9:54 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Upgrade table structure
Hi
We have a similar situation, every time our app is upgraded the DB
structure changes. I just know Im going to get lots of flames for this
but this is what we do......
(all automated)
If the system detects the DB structure is old we
Backup DB (in case of problems).
Build a new empty DB
Pump (using IBO pump) data from the old DB to the new DB
This gives us MANY advantages over a modify script.
1. Dead simple to maintain. No need to maintain modify DB statements.
This is especially useful as our clients are likely to skip one or more
updates.
2. Can add /delete / modify fields, triggers, procedures etc without
worrying about dependencies
Downsides
1. Slow (for a half gig DB this can take 20+ minutes). This is negated
by the fact that our updates only take place a relatively small number
of times a year.
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
Gustavo wrote:
>Hello:previous version, it frequently occurs that there are changes in the
>
>I have an application developped in Delphi 5, using Firebird and IBX.
>
>When I install a new version of my software in a PC which has installed the
structure of some tables. What I want to do is that my application could
automatically upgrade the table´s structures that changed.
>FIELD so I though of modifying RDB$FIELDS with UPDATE statements.
>I summarize the possible changes and the solution I thought for each one:
>
>A new field was added: ALTER TABLE table ADD ...
>A field was discarded: ALTER TABLE table DROP ...
>A new index was added: CREATE INDEX ...
>An index was discarded: DROP INDEX ...
>A field has changed (length, etc.): I didn´t found a statement like ALTER
>way?
>My question is. Is this a good way to do this? Does anyone know a better
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>Thanks in advance
>
>Gustavo
>
>
>[Non-text portions of this message have been removed]
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
_____
YAHOO! GROUPS LINKS
* Visit your group "firebird-support
<http://groups.yahoo.com/group/firebird-support> " on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
_____
[Non-text portions of this message have been removed]