Skip to content

Subgrid does not cascade deletion on child tables in Sqlite

Sqlite online documentation states that

Foreign key constraints are disabled by default (for backwards compatibility), so must be enabled separately for each database connection.

If you have Premium or higher license, in cls_db.php (around line 102), add "PRAGMA foreign_keys = ON" to enforce foreign key constraints:

...
case "sqlite":

$this->db = ADONewConnection('sqlite3');
$this->db->Connect($this->hostName);
$this->db->Execute("PRAGMA foreign_keys = ON;");
break;
...

Now, deletion on master data now also deletes child rows! 

Special thanks to Marcus Schmidtner for this contribution!

Feedback and Knowledge Base