I follow the instructions to migrate the database from native H2 to PostgreSQL here. I host Metabase through Docker on an AWS EC2 instance and a PostgreSQL instance on AWS RDS. When I run the command on step 4, I get the error trace below. I already added the rules security rules to port 5432 on the default security group and can connect outside the EC2 instance using an IDE—however, the migration jar file still complains as logged below. May you help me understand its sorrows?
clojure.lang.ExceptionInfo: ERROR Set up h2 source database and run migrations...: The database is read only; SQL statement:
UPDATE DATABASECHANGELOG SET FILENAME = ? [90097-197] {}
Caused by: org.h2.jdbc.JdbcBatchUpdateException: The database is read only; SQL statement:
UPDATE DATABASECHANGELOG SET FILENAME = ? [90097-197]
Hi @brunolnetto
It says that the H2 file is read-only, so change the permissions of the file.
Without seeing all the commands you input, or knowing your current setup, then it's difficult to tell what you are doing to end up in this situation.
I follow the instructions on the website precisely. As an exercise for yourself, host a docker instance locally and migrate it. The steps I follow are:
Check DB connection (status: ok);
Run command docker cp metabase:/metabase.db/metabase.db.mv.db ./ to backup the database
Change file permission by command run chown +x metabase.db.mv.db;
Stop metabase container with command docker stop METABASE_CONTAINER_ID
@brunolnetto Try reading the error it is returning. It says that you are now pointing to a H2 instead of Postgres, and that H2 is already setup. Seems like you have forgotten to set the environment variable pointing to the Postgres.