Ah, I see. Where does MappedManyToMany delete anything not in the join table? If you mean the spec feel free to change it or comment out the whole thing and ask me to fix it. By the way it's hardcoded to use H2MemoryProvider. Is OneToMany doing anything bad? Thanks.
------------------------------------- Derek Chen-Becker<[email protected]> wrote: Currently ensureConstraints calls DriverType.supportsForeignKeys_?, defaulting to false. The ticket that I'm working on is because none of the drivers seem to override that. The current MappedManyToMany throws an FK violation exception because it tries to delete one side of the Many-To-Many without first deleting the join table entry. Derek On Sun, Dec 13, 2009 at 5:45 PM, Naftoli Gugenheim <[email protected]>wrote: > Are FKs not created using a Driver that supports it? schemify calls > ensureConstraints which seems to do it, no? > > ------------------------------------- > Derek Chen-Becker<[email protected]> wrote: > > If FKs are enabled then the spec fails because you're intentionally trying > to break the joins by deleting the Companys that are on the other side of > the many-to-many. I'm not sure that FKs should be enabled by default, but > if > I add the option to introduce them with schemify then I could write another > spec that assumes FKs are enabled and expects an exception if you try to > delete a joined entity. > > Derek > > On Thu, Dec 10, 2009 at 3:22 PM, Naftoli Gugenheim <[email protected] > >wrote: > > > What about that spec I threw together in a hurry implies that foreign > > keys would conflict with mapper? > > See a recent (few weeks ago) thread discussing how many-to-many should > > deal with broken joins. > > Why would one not want them to be created by default? > > P.S. Sorry I never made that ticket for H2 FK support. > > > > On 12/8/09, Derek Chen-Becker <[email protected]> wrote: > > > OK, I've run into a snag. Schemifier does support foreign key creation, > > as > > > do most of the database vendors. The ManyToMany Mapper support, > however, > > > seems to expect no foreign key constraints, since it's explicitly > testing > > > broken refs in the ManyToManySpecs tests: > > > > > > "ManyToMany" should { > > > "skip broken joins in children" in { > > > setupDB > > > val person = createPerson > > > person.companies.joins.length must_== 10 > > > person.companies.all.length must_== 8 > > > } > > > ... > > > > > > I wonder if we should have FK generation be a configuration parameter > for > > > schemify. I could change the code so that the default schemify method > > > continues to generate DDL without FK constraints, but add a second > > schemify > > > method that takes a boolean parameter controlling whether FKs are > > generated. > > > That, coupled with the DriverType.supportsForeignKeys_?, would allow > > people > > > to add FKs if they want. Thoughts? > > > > > > Derek > > > > > > On Sun, Dec 6, 2009 at 5:40 PM, Derek Chen-Becker > > > <[email protected]>wrote: > > > > > >> Absolutely. I have a PG 8.0, 8.1 and 8.3 instance set up for testing > on > > my > > >> home box because of the last time I made a PG-related change. > > >> > > >> Derek > > >> > > >> > > >> On Thu, Dec 3, 2009 at 2:48 PM, David Pollak < > > >> [email protected]> wrote: > > >> > > >>> > > >>> > > >>> On Thu, Dec 3, 2009 at 1:47 PM, Derek Chen-Becker > > >>> <[email protected]>wrote: > > >>> > > >>>> I agree on both points (foreign keys and documentation). Please open > a > > >>>> ticket asking for proper foreign key support and I'll work on it > next > > >>>> week. > > >>>> > > >>>> > > >>> Please make sure it works on PG 8.0/8.1 as there is at least 1 Lift > app > > >>> in > > >>> production against 8.0 > > >>> > > >>> > > >>>> Derek > > >>>> > > >>>> > > >>>> On Wed, Dec 2, 2009 at 6:05 PM, Julian Backes < > > >>>> [email protected]> wrote: > > >>>> > > >>>>> Hi Derek, > > >>>>> > > >>>>> > It's been a long time since I looked at that particular code, so > I > > >>>>> > may > > >>>>> > have misspoke. Having said that, if it's currently disabled in > the > > >>>>> > driver I'm not sure why and I would want to review it before > saying > > >>>>> that > > >>>>> > it works properly in all cases. > > >>>>> I think the problem here is that the user expects (like I did) > > foreign > > >>>>> keys to be created if he uses mapper classes referencing other > mapper > > >>>>> classes. This "behaviour" should at least be mentioned somewhere in > > the > > >>>>> documentation (btw, the documentation is in my opinion the biggest > > >>>>> problems of Lift at the moment). > > >>>>> I think, using a relational database without foreign keys is > somehow > > >>>>> not > > >>>>> very useful because you never really know whether you have > > referential > > >>>>> integrity... > > >>>>> It would be great if you looked at the code and enabled it. This > > would > > >>>>> really be an improvement for the mapper stuff in Lift 1.1 > > >>>>> > > >>>>> Julian > > >>>>> > > >>>>> -- > > >>>>> > > >>>>> You received this message because you are subscribed to the Google > > >>>>> Groups "Lift" group. > > >>>>> To post to this group, send email to [email protected]. > > >>>>> To unsubscribe from this group, send email to > > >>>>> [email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > > > > >>>>> . > > >>>>> For more options, visit this group at > > >>>>> http://groups.google.com/group/liftweb?hl=en. > > >>>>> > > >>>>> > > >>>>> > > >>>> -- > > >>>> You received this message because you are subscribed to the Google > > >>>> Groups > > >>>> "Lift" group. > > >>>> To post to this group, send email to [email protected]. > > >>>> To unsubscribe from this group, send email to > > >>>> [email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > > > > >>>> . > > >>>> For more options, visit this group at > > >>>> http://groups.google.com/group/liftweb?hl=en. > > >>>> > > >>> > > >>> > > >>> > > >>> -- > > >>> Lift, the simply functional web framework http://liftweb.net > > >>> Beginning Scala http://www.apress.com/book/view/1430219890 > > >>> Follow me: http://twitter.com/dpp > > >>> Surf the harmonics > > >>> > > >>> -- > > >>> You received this message because you are subscribed to the Google > > Groups > > >>> "Lift" group. > > >>> > > >>> To post to this group, send email to [email protected]. > > >>> To unsubscribe from this group, send email to > > >>> [email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > <liftweb%[email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > > > > >>> . > > >>> For more options, visit this group at > > >>> http://groups.google.com/group/liftweb?hl=en. > > >>> > > >> > > >> > > > > > > -- > > > > > > You received this message because you are subscribed to the Google > Groups > > > "Lift" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > . > > > For more options, visit this group at > > > http://groups.google.com/group/liftweb?hl=en. > > > > > > > > > > > > > -- > > > > You received this message because you are subscribed to the Google Groups > > "Lift" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]> > > > > . > > For more options, visit this group at > > http://groups.google.com/group/liftweb?hl=en. > > > > > > > > -- > > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en.
