I\'m using Ruby with SQLite3 and my attempts to use foreign keys in Sqlite3 were unfortunately not successful. According to sqlite3 --version, version 3.7.13 is
sqlite3 --version
Put this at the top of the file that executes the SQL commands and it will enable foreign keys on runtime.
db = SQLite3::Database.new("database.db") db.execute("PRAGMA foreign_keys = ON")