Data loss when upgrading from 1.52 to 1.92 #20215

Closed
opened 2026-02-21 20:06:20 -05:00 by yindo · 1 comment
Owner

Originally created by @zuohaoda on GitHub (Nov 8, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.52

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Download the latest code;
  2. Modify .env;
  3. Migrate the volumes folder;
  4. Start docker compose

The volumes folder of version 1.52 has been completely transferred. When opening it for the first time, you are required to create an administrator account. After logging in, the data no longer exists.

✔️ Expected Behavior

Accounts and related configuration data are migrated normally

Actual Behavior

Data loss

Originally created by @zuohaoda on GitHub (Nov 8, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.52 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Download the latest code; 2. Modify .env; 3. Migrate the volumes folder; 4. Start docker compose The volumes folder of version 1.52 has been completely transferred. When opening it for the first time, you are required to create an administrator account. After logging in, the data no longer exists. ### ✔️ Expected Behavior Accounts and related configuration data are migrated normally ### ❌ Actual Behavior Data loss
yindo added the 🐞 bug label 2026-02-21 20:06:20 -05:00
yindo closed this issue 2026-02-21 20:06:20 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 8, 2025):

The most likely cause of your data loss is that the PostgreSQL database volume (./volumes/db/data) was not properly migrated or mounted during your upgrade. When Dify prompts you to create a new admin account after an upgrade, it means the application cannot find the previous database data—so it treats the environment as a fresh install and all previous accounts, apps, and configuration are missing. This is not due to a destructive migration script, but rather the absence or misplacement of the persistent database files that store your data. Dify's upgrade and migration logic does not erase user data unless the database is empty or a setup attempt fails catastrophically, which is rare and usually only during initial setup errors1 2 3 4 .

To prevent this, always ensure:

  • The entire ./volumes/db/data directory from your old deployment is copied to the new one before starting the new containers.
  • The Docker Compose file correctly mounts this directory to /var/lib/postgresql/data in the db service.
  • After copying volumes, run all database migration commands inside the API container (e.g., flask db upgrade and flask migrate-data-for-plugin) to align the schema with the new version5 6 7 .

If your old ./volumes/db/data directory is empty or missing, the data is unfortunately unrecoverable unless you have a backup. If you do have a backup, restore it to the correct location and restart the containers.

For future upgrades, always:

  1. Stop all containers.
  2. Back up the entire volumes directory and your .env file.
  3. Copy these to the new deployment.
  4. Start the new version and run the necessary migration commands5 6 7 .

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 8, 2025): <!-- Answer --> The most likely cause of your data loss is that the PostgreSQL database volume (`./volumes/db/data`) was not properly migrated or mounted during your upgrade. When Dify prompts you to create a new admin account after an upgrade, it means the application cannot find the previous database data—so it treats the environment as a fresh install and all previous accounts, apps, and configuration are missing. This is not due to a destructive migration script, but rather the absence or misplacement of the persistent database files that store your data. Dify's upgrade and migration logic does not erase user data unless the database is empty or a setup attempt fails catastrophically, which is rare and usually only during initial setup errors[^1][^2][^3][^4]. To prevent this, always ensure: - The entire `./volumes/db/data` directory from your old deployment is copied to the new one before starting the new containers. - The Docker Compose file correctly mounts this directory to `/var/lib/postgresql/data` in the `db` service. - After copying volumes, run all database migration commands inside the API container (e.g., `flask db upgrade` and `flask migrate-data-for-plugin`) to align the schema with the new version[^5][^6][^7]. If your old `./volumes/db/data` directory is empty or missing, the data is unfortunately unrecoverable unless you have a backup. If you do have a backup, restore it to the correct location and restart the containers. For future upgrades, always: 1. Stop all containers. 2. Back up the entire `volumes` directory and your `.env` file. 3. Copy these to the new deployment. 4. Start the new version and run the necessary migration commands[^5][^6][^7]. [^1]: [Dify issue #15369](https://github.com/langgenius/dify/issues/15369) [^2]: [Dify issue #14841](https://github.com/langgenius/dify/issues/14841) [^3]: [Dify issue #18681](https://github.com/langgenius/dify/issues/18681) [^4]: [Dify code analysis and migration logic](https://github.com/langgenius/dify/blob/e91105ca87801497611cd3100bc4fecae5cc9deb/api/controllers/console/setup.py#L31-L97) [^5]: [Dify upgrade checklist and migration commands](https://github.com/langgenius/dify/issues/20645) [^6]: [Dify Docker Compose volume configuration](https://github.com/langgenius/dify/blob/e91105ca87801497611cd3100bc4fecae5cc9deb/docker/docker-compose.yaml#L32-L766) [^7]: [Dify upgrade and migration best practices](https://github.com/langgenius/dify/discussions/21741) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/76708412-ce59-43b9-891f-d8bb2db5962b?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28008)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20215