SQL schema and update fixed