schema: reorganize sql structure

Signed-off-by: Alex Dubov <oakad@yahoo.com>