[odb-users] Migration issues with on_delete(set_null) constraint

Anton Paymyshev anton.paymyshev at gmail.com
Fri Jun 23 05:18:41 EDT 2017

Boris, thank you for quick response!

Could you please make new package so I can test it?

On Thu, Jun 22, 2017 at 8:58 PM, Boris Kolpackov <boris at codesynthesis.com>

> Anton Paymyshev <anton.paymyshev at gmail.com> writes:
> > There is also odb::migrate_schema_2(...) method which adds ptr column but
> > ***NO*** ON DELETE SET NULL constraint:
> >           db.execute ("ALTER TABLE \"S\"\n"
> >                       "  ADD COLUMN \"ptr\" INTEGER NULL CONSTRAINT
> > \"ptr_fk\" REFERENCES \"S\" (\"id\")");
> Thanks for the test, I could reproduce the problem.
> SQLite has limited ALTER TABLE support. Specifically, a constraint
> cannot be added by itself, only as part of the column. So we have
> to hack around this but apparently we didn't hack far enough. I've
> now fixed it:
> http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=
> e783a1120b174bac40697000d218796ddf421dfe
> The patch is pretty simple and should apply cleanly to previous versions.
> Alternatively, I can package another pre-release.
> Boris

More information about the odb-users mailing list