We are running Gerrit 2.16, and have fully migrated to NoteDB.
That means that Gerrit's SQL database contains just one table (SCHEMA_VERSION) in use, with one row (VERSION_NBR=170).
At our site, Gerrit's SQL database has always been PostgreSQL. Now that (almost) everything in in NoteDB, I will switch to using H2 for the database.
Below is how I did it. There are simpler ways, but someone may find this useful.
Note: I've done this in on my test system, but not yet on the main production system, so use at your own risk!
###
### Install a local copy of Gerrit (the identical version to production), but use an H2 database
###
cd ~
wget https://gerrit-releases.storage.googleapis.com/gerrit-2.16.war
export site_path_temp=~/gerrit_2.16_install
mkdir -pv ${site_path_temp}
cd ${site_path_temp}
java -jar ~/gerrit-2.16.war init -d ${site_path_temp}/ --dev --no-auto-start # all default answers ok
# Clear up the H2 database so that only the SCHEMA_VERSION table remains
# go to http://localhost:8080/admin/repos/All-Projects,access
# become account "admin"
# add permission "Access Database" for "Administrators"
${site_path_temp}/bin/gerrit.sh start
ssh -p 29418 admin@localhost gerrit gsql
\d
DROP TABLE CHANGES;
DROP TABLE CHANGE_MESSAGES;
DROP TABLE PATCH_COMMENTS;
DROP TABLE PATCH_SETS;
DROP TABLE PATCH_SET_APPROVALS;
SELECT * FROM SCHEMA_VERSION;
\q
${site_path_temp}/bin/gerrit.sh stop
###
### Copy minimal H2 database (${site_path_temp}/db/ReviewDB.h2.db) into Gerrit, and switch to using that ###
sudo /etc/init.d/gerrit stop
sudo systemctl stop postgresql.service # and leave it stopped!
cp -piv ${site_path_temp}/db/ReviewDB.h2.db ${site_path_real}/db/
git config -f ${site_path_real}/secure.config --remove-section database
git config -f ${site_path_real}/gerrit.config database.type h2
git config -f ${site_path_real}/etc/gerrit.config database.database db/ReviewDB
git config -f ${site_path_real}/etc/gerrit.config --unset-all database.hostname
git config -f ${site_path_real}/etc/gerrit.config --unset-all database.username
sudo /etc/init.d/gerrit start
I hope that's useful to somebody.
Matthew