[Nitro] og: automatic deletion of records in M:N relations?

Jonathan Buch john at oxyliquit.de
Sun Aug 27 12:40:43 EDT 2006


> I think I did not make my point clear: My problem ist not wether tags or
> items get removed according to their relation. The problem ist the
> mapping table og creates to maintain many to X relations. Entries in
> this table do not get removed, even if neccesary.
> I added some code to my previous example, to show the real problem:

Yes, I made a testcase for Og.  Relations don't get killed alright.

The reason there is a error message is that sqlite apparently reuses old  
oids when they get removed, which is weird imo.  I'm not sure if the  
standard should be to kill m:n relations when not otherwise specified.

a = Item.new
a.tags << Tag.new
a.delete(true) # << this makes a cascade while deleting, should also  
remove the relations

This should work, although it didn't when I tried.  This was probably  
because of 0.40 is still kinda flaky...

> I think this does not apply to my problem but in general i like your
> idea. On the other hand we already have information about these
> constraints due to the knowledge about their relation.

The relationship constraints (foreign keys) are only one facet of  
constraints.  In my mail before I showed a few other useful ones, of which  
a few are already nicely implemented (primary key, unique).

> nice picture! :)

Of course ;D  Best description of my feelings regarding Ruby ever :P


Feel the love

More information about the Nitro-general mailing list