From 33a8e17efb8c622413a861047c5c4589a9828f62 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 24 Oct 2013 08:53:55 +0200 Subject: Disable SQLite foreign key checking while updating schema --- evolution/add-table/driver.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'evolution/add-table') diff --git a/evolution/add-table/driver.cxx b/evolution/add-table/driver.cxx index bd62068..da4677e 100644 --- a/evolution/add-table/driver.cxx +++ b/evolution/add-table/driver.cxx @@ -13,6 +13,7 @@ #include #include +#include // DATABASE_XXX #include #include "test2.hxx" @@ -45,11 +46,20 @@ main (int argc, char* argv[]) if (embedded) { + // SQLite has broken foreign keys when it comes to DDL. + // +#ifdef DATABASE_SQLITE + db->connection ()->execute ("PRAGMA foreign_keys=OFF"); +#endif transaction t (db->begin ()); schema_catalog::drop_schema (*db); schema_catalog::create_schema (*db, "", false); schema_catalog::migrate_schema (*db, 2); t.commit (); + +#ifdef DATABASE_SQLITE + db->connection ()->execute ("PRAGMA foreign_keys=ON"); +#endif } object o (1); -- cgit v1.1