Hi Piotr, Thanks for the reply.
On Jan 9, 2012, at 3:03 AM, Piotr Solnica wrote: > Hey Rhett, > > Old behavior was invalid so we've fixed it. You can call auto_migrate! > inside a repository block if you want to migrate repository different > than the default one. When I call auto_migrate in a repository block like so: ::DataMapper.repository(:other) do ::DataMapper.auto_migrate! end DM still applies the schema to the :default repo, not the :other repo. Should I report this as a bug? Also, could you explain the expected difference between: ::DataMapper.repository(:other) do ::DataMapper.auto_migrate! end and ::DataMapper.auto_migrate!(:other) Thanks, Rhett > > Cheers, > solnic > > On Jan 6, 9:30 pm, Rhett Sutphin <[email protected]> wrote: >> Hi, >> >> The behavior of DataMapper.auto_migrate! with regards to multiple-repository >> systems changed in DataMapper 1.2. In 1.1, DataMapper.auto_migrate!('A') >> would drop and recreate tables (etc.) in repo A for all the loaded models. >> In 1.2, it only drops and recreates tables for models whose default >> repository is 'A'. >> >> This is an issue for me because I've got an application with multiple repos >> that I need to all have the same schema. I've been working around it by >> calling model.auto_migrate!('A') for each model. Unfortunately, while >> DataMapper.auto_migrate! generates foreign keys, model.auto_migrate! does >> not. Dm-constraints has code which seems to be for generating FKs from >> model.auto_migrate!, but it is not working for me. (Even if it were working, >> I'm not sure it would work for my particular schema -- there are circular >> relationships in this schema, so there's no model ordering where creating >> the FKs incrementally with the models would work.) >> >> In any case, I can understand the motivation for the >> DataMapper.auto_migrate! change in 1.2 (i.e., different repos with different >> models), but I wonder if the DM team would be open to a patch that restores >> the old behavior as an option. >> >> Thanks, >> Rhett > > -- > You received this message because you are subscribed to the Google Groups > "DataMapper" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/datamapper?hl=en. > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
