SQL adaptation to PostgreSQL

Unfortunately PostgreSQL does not support auto increments, replaced by
simple SERIAL for counts and a random generation for Definitions (which
also help reducing overhead to fetch the newly generated ID, which is
done backend-side and not database-side).
Splitting the UI into various views.

Views now splitted into main/header/footer for better integration in case of
use in multiple pages. Historical page created but empty.