-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Dify compatible with MySQL database #8364
Open
powerfooI
wants to merge
18
commits into
langgenius:main
Choose a base branch
from
powerfooI:enhancement/compat-with-mysql
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Make Dify compatible with MySQL database #8364
powerfooI
wants to merge
18
commits into
langgenius:main
from
powerfooI:enhancement/compat-with-mysql
+3,481
−252
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dosubot
bot
added
size:XXL
This PR changes 1000+ lines, ignoring generated files.
💪 enhancement
New feature or request
labels
Sep 13, 2024
…e mysql as a profile in middleware.yaml
powerfooI
force-pushed
the
enhancement/compat-with-mysql
branch
from
September 18, 2024 06:54
b319a2d
to
befcf4a
Compare
I think we're not quite ready to maintain two sets of migrations yet. |
Actually we just need to archive the old migrations and create future revisions in new migrations. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
💪 enhancement
New feature or request
size:XXL
This PR changes 1000+ lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist:
Important
Please review the checklist below before submitting your pull request.
dev/reformat
(backend) andcd web && npx lint-staged
(frontend) to appease the lint godsDescription
As issue #8343 said, some organizations are expecting to take mysql as database of dify, while there are some postgresql native usages in dify's definition of models that make seamless switch to mysql difficult.
What this PR does are mainly as following,
'some words'::text
with dialect irrelevant ones. Concretely, I did the following replacements.Ignore direct JSON index: MySQL does not support indexing JSON column directly. (Reference)
Add env vars and docker-compose files for MySQL.
Create a separate migrations folder for mysql database and update
upgrade-db
command.This PR resolves #8343 and is related to #415, #3813, #2371.
Type of Change
Testing Instructions
Assume a
main workflow
: User opens the dify webpage, signs up the first account, logs in to the webpage, creates a dataset, uploads several papers, dify embeds the documents, the user does hit tests, creates workflow to retrieve the document segment, dify generates answer for user's question with help of LLM.I have tested the changes with the main workflow on the following deployment x database matrix and all tests passed.
Migrations Compatibility
This PR takes a snapshot of the old migrations' head and create a new migrations folder to make dify compatible with both postgresql and mysql. For users using dify of previous version, they should do
flask db upgrade
andflask db upgrade -d migrations_new
. For users using dify with mysql database, they only need to doflask db upgrade -d migrations_new
. In other word, users using pg and users using mysql will get the identical database schema at the snapshot point.