Mobile Database with foreign key


#1

Hi, I an using Sqlite plugin for databases. But I am having trouble creating foreign keys. I followed the syntax of creating foreign keys while creating tables but foreign key constraints are not working. I also tried PRAGMA foreign = ON; on database but it has no impact. Can anyone guide me how to enforce foreign key constraints in Ionic apps.


#2

same here where you able to figure it out:fearful:


#3

wich sqllite version does the plugin use?

https://www.sqlite.org/foreignkeys.html

This document describes the support for SQL foreign key constraints
introduced in SQLite version 3.6.19.


#4

i dont Know That but if i run this code then it throws error
$cordovaSQLite.execute(db,“PRAGMA foreign_keys= ON”).then(function(res) {
console.log(res);
}, function(err) {
console.error(err);
});

could not prepare statement (23 not authorized)


#5

maybe this helps?