AppFlowy-Cloud icon indicating copy to clipboard operation
AppFlowy-Cloud copied to clipboard

[Bug] migration * was previously applied but has been modified

Open bruvv opened this issue 8 months ago • 4 comments

Describe the bug

Error: Failed to initialize application state: Failed to run migrations: migration 20250318120849 was previously applied but has been modified

04-04-2025 14:32 | {"timestamp":"2025-04-04T12:32:32.894938Z","level":"INFO","fields":{"message":"relation \"_sqlx_migrations\" already exists, skipping"},"target":"sqlx::postgres::notice","filename":"/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-postgres-0.8.2/src/connection/stream.rs","line_number":185} 

04-04-2025 14:32 | {"timestamp":"2025-04-04T12:32:32.874680Z","level":"INFO","fields":{"message":"Connecting to postgres database with setting: DatabaseSetting { pg_conn_opts: PgConnectOptions { host: \"postgres\", port: 5432, socket: None, username: \"postgres\", password: Some(\"********\"), database: Some(\"postgres\"), ssl_mode: Prefer, ssl_root_cert: None, ssl_client_cert: None, ssl_client_key: None, statement_cache_capacity: 100, application_name: None, log_settings: LogSettings { statements_level: Debug, slow_statements_level: Warn, slow_statements_duration: 1s }, extra_float_digits: Some(\"2\"), options: None }, require_ssl: false, max_connections: 40 }"},"target":"appflowy_cloud::application","filename":"src/application.rs","line_number":491}

04-04-2025 14:32 | {"timestamp":"2025-04-04T12:32:32.874599Z","level":"INFO","fields":{"message":"Preparing to run database migrations..."},"target":"appflowy_cloud::application","filename":"src/application.rs","line_number":187} | stdout

04-04-2025 14:32 | AppFlowy Cloud with RUST_LOG=info

To Reproduce Steps to reproduce the behavior: Sorry i do not know, i just use watchtower and it updates my images.

Expected behavior Update and start the container after updating the image.

Desktop (please complete the following information):

  • OS: Synology, DS918+ using Docker version 24.0.2, build 610b8d0
  • Browser n.a.
  • Version latest

Additional context I used git clone and changed .env file and did a docker-compose up -d. This worked for about 4 months just fine but now, after a watchtower update 2 days ago i get this error in the cloud container. And just for completion i did also redo the sudo docker-compose up -d --build to make sure to also get the latest dockerfile builds.

bruvv avatar Apr 04 '25 12:04 bruvv

Getting the same issue here, I will try the previous version to see if that fixes it.

aquaspy avatar Apr 04 '25 14:04 aquaspy

Nope, tried 0.9.35 and 0.9.36 and got the same issue. Looks like we may need to manually fix the error inside the container

aquaspy avatar Apr 04 '25 14:04 aquaspy

Ok, I was able to fix it by checking the support thread on Discord!

For those with the same issue, you can use the following:

docker exec -it <postgres-container-name> psql -U postgres -d postgres

And then

DELETE FROM _sqlx_migrations WHERE version = '20250318120849';
INSERT INTO _sqlx_migrations VALUES(20250318120849, 'departition af collab', NOW(), true, decode('a30cd4aebd807faab8230a0874b0f86f6e7ae1f88d2f9199bbb56eba424bb7e4ed836a8348f43ab2a9cf304a4efc6458', 'hex'), 100);

Thereafter,

docker compose down docker compose up -d

And my AppFlowy is up and running!

aquaspy avatar Apr 04 '25 14:04 aquaspy

That worked indeed! I will keep it open for now for people to find it and perhaps the devs can fix this?

bruvv avatar Apr 04 '25 21:04 bruvv