andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.74k stars 521 forks source link

db.executeSql('PRAGMA foreign_keys = ON'); #570

Open viveKing21 opened 6 months ago

viveKing21 commented 6 months ago
          db.executeSql('PRAGMA foreign_keys = ON');

Execute this after creating connection and it will solve your issue .. it worked for me.

Originally posted by @AdnanAshraf-pro in https://github.com/andpor/react-native-sqlite-storage/issues/478#issuecomment-934100851

‘PRAGMA foreign_keys=ON;’ executed and success callback invokes, but after that if I check ‘PRAGMA foreign_keys;’ it gives result ‘{foreign_keys:0}’ and its not working, accepting any integer as FK and CASCADE not working on Delete.

android devices