Migrate to PostgreSQL, update SQL scripts and connection initialization