Browse Source

Fix sqlite bug ON DELETE CASCADE

Foreign key constraints are not enabled by default.

See https://github.com/marienfressinaud/FreshRSS/issues/579
See http://stackoverflow.com/questions/13534040/sqlite3-foreign-keys-on-pdo
Marien Fressinaud 11 years ago
parent
commit
17d1e67e82
1 changed files with 3 additions and 0 deletions
  1. 3 0
      lib/Minz/ModelPdo.php

+ 3 - 0
lib/Minz/ModelPdo.php

@@ -77,6 +77,9 @@ class Minz_ModelPdo {
 				$db['password'],
 				$driver_options
 			);
+			if ($type === 'sqlite') {
+				$this->bd->exec('PRAGMA foreign_keys = ON;');
+			}
 			self::$sharedBd = $this->bd;
 		} catch (Exception $e) {
 			throw new Minz_PDOConnectionException(