creating db schema
some fixes for db