Hi Chris, On Jan 9, 2012, at 9:22 AM, Chris Corbyn wrote:
> We have run into this too. We assumed it was just never supposed to work and > ended up processing the models manually, calling > Repository#create_storage_model for each model in turn. We may have > overlooked something though. I'll give this another go in the morning > (2:20am here and going to bed) and will confirm if this is broken or not. I was doing something similar (calling model.auto_migrate!(:other)), but I found that dm-constraints would not apply FKs to the schema in this case. This is why I brought the question to the list. Thanks for your input, Rhett > > > On 10/01/2012, at 2:17 AM, Rhett Sutphin wrote: > >> 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. >> > > -- > 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.
