Excluding a Model/Repository from migration?

4 views
Skip to first unread message

fbettag

unread,
May 12, 2009, 5:35:47 PM5/12/09
to DataMapper
Hey guys,

i've been playing around with dm-ldap-adapter all day, the problem is
that unless i remove my model, autoupgrade is failing.
Is there any way to "blacklist" repositories (named ldap in my case)
or models for migration?

Since i was looking into the code i found auto_upgrade methods which
can have repository_name supplied, thats where i got the idea of
blacklisting whole repositories.

Any advice would be helpful!

best regards

Martin Gamsjaeger

unread,
May 12, 2009, 11:27:35 PM5/12/09
to datam...@googlegroups.com
Franz,

Try what dm-is-remixable does in such a situation:

http://is.gd/zmyc

Since auto_upgrade! is a class method you should be fine to do

class Zoo
include DataMapper::Resource
def self.auto_upgrade!(args = nil)
DataMapper.logger.warn("Skipping #{self.name}.auto_upgrade! for
whatever reason")
end
end

Hope that helps

cheers
snusnu

fbettag

unread,
May 12, 2009, 11:39:09 PM5/12/09
to DataMapper
Thank you very very much! I kinda thought of that, but i don't recall
why i didn't try it out.. but i would've never gotten the idea of the
logger message ;)
Reply all
Reply to author
Forward
0 new messages