Reputation: 1662
In android 2.2 and higher SQLite supports foreign keys but they are disabled by default. In my application I use database.execSQL("PRAGMA foreign_keys=ON"); every time after open database.
I have two questions:
Thanks!
Upvotes: 0
Views: 128
Reputation: 17077
Foreign keys are disabled by default in stock SQLite also (for backwards compatibility) - I think it even says so in the SQLite FK documentation. So Android is simply not messing with the default behaviour.
The PRAGMA
is the correct way to enable foreign key support.
Upvotes: 3