Blogger Avatar

人間になりたい!!!!!


皖ICP备2025096275号

Fix Solution for umami - prisma migrate deploy in Docker Environment

Preface

While maintaining the Umami analytics system on a Linux server, the blogger encountered the following error after restarting the Linux host: prisma migrate deploy. After some research, two potential solutions were found. Please follow this tutorial.


Environment

  • OS: Ubuntu 24.04.1
  • App: umami 2.19.0 - Docker

    Section 1 - Can Connect to Umami Shell

    If you can stably connect to the Umami shell, follow this part of the tutorial.

    Note: Docker's default policy is to restart a container if the main process exits. Therefore, this scenario of being able to connect stably is extremely rare.

1.1 Rebuild the migration

  • Start the Umami shell and access its console.
  • Enter the following command:

    npx prisma migrate resolve --applied "05_add_visit_id"
  • Restart Umami.
    If Umami starts normally after the restart, the process ends here.

Section 2 - Cannot Connect to Umami Shell

If you cannot connect stably to the Umami shell or cannot connect at all, follow this part of the tutorial.

2.1 Rebuild the migration from the Database

  • Use the docker ps command to list containers.
  • If your database type is MySQL, enter the following command to access the database shell:

    docker exec -it <containerID> mysql -u <userName> -p <databaseName>
    • containerID - The container ID, which is the string at the beginning of the docker ps list.
    • userName - The username used by the Umami container.
    • databaseName - The name of the Umami database.
  • After entering the password to access the container shell, enter the following command:

    UPDATE _prisma_migrations
    SET finished_at = NOW(), logs = NULL, applied_steps_count = 1
    WHERE migration_name = '05_add_visit_id';
  • After execution, type exit; to exit the shell.

2.2 Restart Umami

  • Restart Umami and observe if it runs normally. If it runs normally, the tutorial ends. If it still does not run normally, enter the following command:

    docker exec <containerID> npx prisma migrate resolve --applied "05_add_visit_id"
    • containerID - The container ID of the Umami container.
  • Then restart Umami again. If it runs normally, the tutorial ends.

Postscript

If you find any issues in the article, feedback from readers is welcome. Thank you for reading!

Fix Solution for umami - prisma migrate deploy in Docker Environment
https://blog.nanami.tech/en/archives/134/
Author Madobi Nanami
Publish Time 2025-10-23
License CC BY-NC-SA 4.0
Only 1 comment
  1. Comment Avatar

    第一第一OωO

    Ling October 23rd, 2025 at 07:24 pm Reply
Post a new comment