From 71d51596aee6fd49728d6e135cb11a0ed9990cf7 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Sat, 21 Mar 2020 15:41:03 +0100 Subject: [PATCH] Enable foreign key support --- lib/database.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/database.dart b/lib/database.dart index 7223887..e374a9a 100644 --- a/lib/database.dart +++ b/lib/database.dart @@ -29,6 +29,13 @@ class Database extends _$Database { @override int get schemaVersion => 1; + @override + MigrationStrategy get migration => MigrationStrategy( + beforeOpen: (details) async { + await customStatement('PRAGMA foreign_keys = ON'); + } + ); + // TODO: Remove this once https://github.com/simolus3/moor/issues/453 is fixed. Selectable worksByComposer(int id) { return customSelectQuery(