Fix tests and add SQL schema

Fix #2