Add foreign keys

- [x] use structure.sql instead of schema.db to capture `INITIALLY DEFERRED` 
- [x] rebase against master