Fix SQLConnections bug; add foreign key in schema