(Mostly) fixing broken schema.sql. Bug still present, won't import. MySQL error #1170.