Reference correct table
Set PRAGMA foreign_keys=ON on every open

See http://www.sqlite.org/foreignkeys.html#fk_enable
Merge pull request #32 from vonloxley/reference_correct_table

Wrong reference generation / PRAGMA foreign_keys not set