Migrate a c-lightning database from SQLite to Postgres!
Why migrate
Because Postgres is very good, it supports remote access, simultaneous readers and writers, it can replicate writes with instances elsewhere, so your channels are safer. Everything is better.
Beware: this may destroy your life and make you lose all your money, use at your own risk.
How to use
Download the release corresponding to the database version of your lightningd.sqlite3 file. To find out what is your version, run sqlite3 ~/.lightning/bitcoin/lightningd.sqlite3 'select version from version'. If there's no release corresponding to your version, upgrade to the newest master and ping me so I can make a new release with the latest changes.
Your c-lightning should be compiled with support for PostgreSQL. That happens automatically if you have libpq installed.
Create a database on Postgres.
Stop your c-lightning daemon: lightning-cli stop.
Run mcldsp -sqlite=/home/user/.lightning/bitcoin/lightningd.sqlite3 -lightningd=(which lightningd) -postgres='postgres:///myclightningdatabase?sslmode=disable' (replace with your actual values).
Change your ~/.lightning/config file, add a wallet=postgres:///myclightningdatabase there so the next time it starts it will use the PostgreSQL database and not the SQLite file.
Start lightningd again and check if everything works.
Delete mcldsp so you never run it again.
Delete your lightningd.sqlite file so you don't try to use it again.