dify deployment error: table does not exist, why?

Hello! Many thanks to @lysonober for the correction. Dify has indeed introduced support for MySQL protocol databases (including OceanBase/SeekDB) in v1.10.1 and higher versions. I apologize for the outdated information I provided earlier.

Regarding your latest configuration and error situation, the problem is very likely with the configuration value DB_TYPE=seekdb.

Cause Analysis

Dify uses SQLAlchemy as its ORM framework. Although you are using SeekDB, in Dify’s configuration file, for the system to correctly load the MySQL driver (pymysql) and dialect, DB_TYPE must be set to mysql.

When configured with a non-standard value like seekdb, Dify may not recognize the database type, leading to the database migration scripts (Migration) being skipped or failing during initialization. Consequently, the database connection succeeds (you can see connection records), but core business tables (such as workflow_schedule_plans) are not created.

Solution

Please try the following steps to correct the configuration and initialize the database:

1. Modify .env Configuration

Change DB_TYPE to mysql:

# Before modification
# DB_TYPE=seekdb

# After modification
DB_TYPE=mysql

# Others remain unchanged
DB_USERNAME=root
DB_PASSWORD=seekdb
DB_HOST=X.X.X.X
DB_PORT=2887
DB_DATABASE=test

2. Restart and Check

After modification, restart the Dify service:

docker compose down
docker compose up -d

3. Manually Execute Migration (If Errors Persist After Restart)

If tables are still not created after restarting, it might be because a previous error state prevented automatic migration from triggering. It is recommended to manually run the migration command, which will also show specific error details:

# 1. Enter the API container (please confirm your container name is docker-api-1 or dify-api-1)
docker exec -it docker-api-1 /bin/bash

# 2. Manually execute database upgrade
flask db upgrade
  • If successful: you will see a series of Running upgrade ... logs, and the table structure will be created upon completion.
  • If it fails: please post the error logs from flask db upgrade, which will help determine if it’s a compatibility issue with SeekDB for certain SQL syntaxes.

:books: Documentation Reference:

  • Environment Variable Description: In v1.10.1+, DB_TYPE supports postgres or mysql.

Hope this solves your problem!