Subject Re: [firebird-support] database refactoring
Author Mike Dewhirst
Woody wrote:
> From: "Mike Dewhirst" <miked@...>
>> Database refactoring has been of great interest to me for long time.
>> Largely because I have never been able to foresee requirements far
>> enough ahead to ever get the design right first time.
>>
>> This link is an essay (five minute read) by Martin Fowler on the topic.
>>
>> http://www.martinfowler.com/articles/evodb.html
>>
>> Does anyone in this group know of the availability of scripts/tools
>> described in the essay for Firebird projects?
>>
>> If not, is anyone interested in building some of them?
>>
>> I would be keen to become involved and contribute.
>
> I built my own small app that I call the Versionator. With it, I can add any
> project I work on that uses FB databases. Anytime a change is needed to the
> structure of the database for a project, I add a new update and put the SQL
> code needed such as adding columns, tables, stored procedures, etc. I can
> also use DML code to perform tasks such as setting new fields to default
> values, etc. The program will save the projects' Versionator update
> information to a data file. The unit that controls the data file can be
> included in any program and it can read the data file and determine if any
> updates are needed for a database. Update names/numbers are stored in the
> database so that none of them are run more than once.
>
> Using this, I can update any version of a database to the current revision
> simply by calling a Versionator function and all updates are performed
> automatically. Sadly, as always it seems, it is written as a personal tool
> so I didn't put much thought into it regarding others who might want to use
> it.

Not sadly at all. Fantastic I say. I usually cut corners and just tweak
things manually and never look backwards and learn. I know I should do
what you did but sadly, I didn't.

One of the most important things that would have to be changed would be
> having the code use the API directly instead of using any certain database
> components or the module built into a small DLL or program that could be
> called from an application.
>
> Not quite sure if that's what you mean by a refactoring tool or not.

I think it is. Especially the ability to write change information to a
file which can be translated into actual database refactorings.

Would you care to discuss the design decisions you made in Versionator?

What do you think of Fowler's list of 'simple' tools?

Quoting from Fowler's article ...

"One of the most valuable pieces of automation is a simple set of
scripts for common database tasks.

* Bring a user up to date with the current master.
* Create a new user
* Copy a database schema, for example Sue finds a bug with her
database, now Mike can copy Sue's database and try to debug the application
* Move a database, for example from a workstation to a different
workstation, this is essentially Copy database and Delete database
combined as one
* Drop a user
* Export a user so team members can make offine backups of the
database that they are working with.
* Import a user, so if the team members have a backup copy of the
database, they can import the backup and create a new schema.
* Export a baseline - make a backup copy of the master database.
This is a specialized case of Export a User
* Create a difference report of any number of schemas, so that Mike
can find out what is different structurally between his database and Sue's.
* Diff a schema against the master, so that developers can compare
their local copy against the master.
* List all the users

Regards

Mike


>
> Woody (TMW)
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> 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
>
>
>
>
>
>
>
>
>