Comment 3 for bug 490280

Revision history for this message
James Henstridge (jamesh) wrote :

Here are some of the concerns from the other bug that apply:

Imagine the following set of classes (syntax is up in the air, but should get the point across):

    class Bar(object):
        __storm_table__ = "bar"
        id = Int(primary = True)
        foo_id = Int()
        qualifier = Int()

    class Foo(Storm):
        __storm_table__ = "foo"
        id = Int(primary=True)
        bars = ConstrainedReferenceSet(id, Bar.foo_id, Bar.quaifier == 42)

1. If we issue the command "foo.bars.add(bar)", is it responsible for setting bar.qualifier? If not, should it try to verify that bar.qualifier is set appropriately, or leave that to database level constraints?

2. What is the result of the following statements:
    foo = Foo()
    bar = Bar()
    bar.qualifier = 42
    foo.bars.add(bar)
    bar.qualifier = 0
    del bar
    store.add(foo)
    store.flush()

3. What should "foo.bars.remove(bar)" do? The two possibilities are to set bar.foo_id to None (what happens with unconstrained reference sets), or change bar.qualifier (to what?).