Add foreign key pragma and associated tests