Subject Re: [firebird-support] Re: How to update table structure with SQL?
Author Woody
From: "neighbour.kerry" <kerry@...>
>
> The only way I would use a versioning system is if I could put a version
> number in every table (as DBISAM does). Having a version at the database
> level is not much point, since I do updates at the table level.
>

The only time you do database level updating is when changing engine
versions. Any other time it's always table level updating so that's not an
argument.

IMHO, no one needs a version # on each table unless the tables are stored in
separate files instead of one database file. And in that case, I'd prefer to
use another separate table which contained the information that I maintained
anyway. You have to visit each table to check version numbers instead of
just checking one for the database. Do you also keep each table's version
SQL in separate files to perform the updates? That would seem kind of
wasteful and harder to maintain IMO.

It took me about a day, maybe 2, to write my own versioning system for FB
and I have never had a problem in the many years I've used it. I've never
needed a DB comparison tool nor do I anticipate a need for one in the future
since I start all my databases with my own version info table in the initial
DDL for creating the DB. If DDL changes are needed when I send out an
update, I also send an update data file which is automatically
read/performed when the administrator applies the update. All done without
anyone on site knowing/caring what goes on behind the scenes.

It's true that not all column changes can be done simply by changing the
type but I don't think too many databases out there allow all type changes
regardless of old and new field type. Generators don't normally need to be
dropped nor changed except in the most extreme circumstances such as
renumbering the ID column that they are used for.

You don't need an "IF EXISTS" for a field/table if you already have version
numbering since you will know automatically what state the database is in.
Even if you don't know, it's a simple SQL statement to query system tables
to do the check for you before attempting to add the field/table.

I think you are making this more complicated than it needs to be, really. I
have yet to run across any database engine which can account for any and all
situations you might run into in the field. FB has it's differences but the
benefits of using it has vastly outweighed any shortcomings that I've ever
seen. Maybe your situation is different, maybe not. Just my $0.02 worth.

Woody (TMW)