[odb-users] Update the id of an object which has a relation with
the other object
boris at codesynthesis.com
Tue Apr 26 10:03:26 EDT 2016
> > Sounds like a job for ON UPDATE CASCADE. I think this should work:
> > #pragma db value_options("ON UPDATE CASCADE")
> > QList<std::shared_ptr<OTHER_CLASS>> m_otherClassList;
> "value" INTEGER NULL ON UPDATE CASCADE,
> CONSTRAINT "value_fk"
> FOREIGN KEY ("value")
> REFERENCES "KeywordIndex" ("id")
> DEFERRABLE INITIALLY DEFERRED)
Yes, "ON UPDATE CASCADE" should be in the CONSTRAINT clause. I guess
that's why we have the on_delete pragma ;-).
I guess the two options are to manually tweak the schema to move it
to the correct place or to implement the on_update pragma. I could do
the latter but it will take me some time (pretty swamped at the moment).
More information about the odb-users