I'm new to Ruby on Rails, and I'm using SQLite3 as a database for my sample project. I am trying to create the usual relationship between two models (for example, each product has one Owner, and each Owner can have many products). This works great, and the database schema is created correctly. However, when I open development.sqlite3 in the database management tool (I use the free SQLite Express Personal http://www.sqliteexpert.com/download.html ) I do not see that the database has referential integrity. There are no foreign keys for the Product table, even if they contain owner_id columns .
I tried changing database.yml by adding an options key:
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
options: "PRAGMA foreign_keys=ON"
And then recreate the database with:
rake db:drop db:create db:migrate
This recreates the database, but again there are no foreign keys.
Am I doing something wrong? Is there any solution for this at all. (PS. I run it all on Windows 8.1, if that matters)
source
share