stmichael / data-import

sequel based dsl to migrate data from a legacy database to a new home.
MIT License
42 stars 9 forks source link

automatically add dependencies for reference blocks #44

Open senny opened 12 years ago

senny commented 12 years ago

this is just an idea, I'm not sure if I like it though.

I find myself writing the following code a lot:

import 'something' do

  dependencies 'other thing'

  reference 'other thing', 'field' => :field
end

I thought about adding the dependencies for reference mappings automatically since the table you reference always needs to be loaded. The drawback is, that you don't see all the dependencies on a single line but it would remove some duplication.

senny commented 12 years ago

@stmichael thoughts?

stmichael commented 12 years ago

I'm a torn between yes and no. Yes because it is beneficial for smaller definitions where you see the references instantly and you don't have any other dependencies. No because it would split the dependencies into the actual dependencies and those in the references which is leads to a chaos. Then again if that happens you could still explicitly define all dependencies.

senny commented 12 years ago

I came up with the idea because I had to switch a reference column to another definition. Of course I had to wait 30 minutes to find out, that I forgot to change the dependencies :( I think you notice it's duplication when things get more error prone than they should be.