On 28.07.2010 16:50, Fabian Marin wrote:
> Robert Klemme wrote:
>> On 28.07.2010 03:57, Fabian Marin wrote:
>>> must (eventually) match the schema proscribed by the DDL.
>>> I've done my share of research, looking for a similar tool to avoid
>>> reinventing the wheel.  However, I could not reach the author of
>>> db_discovery (http://rubyforge.org/projects/db-discovery/), and
>>> otherwise I found no other author.  It seems like db_discovery did not
>>> find a niche even though it seems to be a very good tool.
>>>
>>> Does anyone know if such a tool already exists and is actively
>>> supported??? As a newbie Rubyist I'm trying to exploit the power of this
>>> community by querying you guys to make sure such a tool would actually
>>> be novel.
>>
>> It wouldn't.  This is a solved problem already, for example Sybase has
>> an excellent product which has sophisticated schema comparison
>> functionality with a good graphical UI:
>> http://www.sybase.com/products/modelingdevelopment/powerdesigner
>
> Is Sybase open source?

No.

>  I'm disregarding proprietary, non open source
> solutions.

Well, you didn't say so initially if I'm not mistaken.

>>> As for its implementation I have a couple of ideas (e.g. parse DDL as an
>>> external DSL using a multiple dispatch library, use ActiveRecord to
>>> reflect on a database's schema).  However, I want to make sure that such
>>> a tool would actually benefit the community.
>>
>> I would create these tools:
>>
>> 1. schema extractor into a standard format which you define (could be an
>> XML representation or just marshalled object model).
>>
>> 2. diff for the standard format schema (two way, maybe also three way)
>>
>> 3. maybe also a converter from a given DDL to the standard format so you
>> do not have to go through the DB although this might be fragile since
>> the actual DB's settings may influence how the schema eventually looks.
>
> How about this option?
>
> Use RoR Active Record to create a model from a DDL file, and also a
> comparable model from a DB, then generate a module that can compare
> equivalent Entity/Table classes from both?

The key question is: can an AR model represent a DB schema entirely? 
What does it tell you about constraints and triggers?  Does it cover all 
sorts of special indexes as Oracle's FBI's and special types found only 
in one RDBMS?

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/