From bdc7fac25deed7f3a4d9e6dd228455a27361ae26 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Wed, 7 Sep 2016 14:22:28 +0200 Subject: [PATCH] Skip foreign key creation on SQLite3 --- dialect_sqlite3.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dialect_sqlite3.go b/dialect_sqlite3.go index 2abcefa5..091ff107 100644 --- a/dialect_sqlite3.go +++ b/dialect_sqlite3.go @@ -89,6 +89,15 @@ func (s sqlite3) HasColumn(tableName string, columnName string) bool { return count > 0 } +func (s sqlite3) HasForeignKey(tableName string, foreignKeyName string) bool { + // We return intentional true here since foreign keys are a little bit + // complicated on SQLite. You have to enable them first to being able to + // create and use them. Since a true value here prevents any further query to + // create the foreign key we just added that. For further information about + // foreign keys on SQLite take a look at http://www.sqlite.org/foreignkeys.html + return true +} + func (s sqlite3) CurrentDatabase() (name string) { var ( ifaces = make([]interface{}, 3)