Skip to content
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

feat: add IF NOT EXISTS config for migrator #6627

Closed
wants to merge 11 commits into from

Conversation

zhtiyissr
Copy link

@zhtiyissr zhtiyissr commented Oct 8, 2023

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

When migrator needs to be executed concurrently, it is not enough to judge by HasTable(), which will cause CreateTable() to return the table is already exist error. To avoid this error, hopefully use the IF NOT EXISTS statement. This change is forward compatible and will not cause changes to existing code.

User Case Description

Assume that in an APP, user login, registration, browsing, click and other events need to be processed, and these events need to be recorded in the table, then the table needs to be dynamically divided according to user_id. In a distributed scenario, when browsing and clicking events are processed concurrently, When, it may cause Migrator to be abnormal.

@zhtiyissr zhtiyissr changed the title feat: add IF NOT EXIST config for migrator feat: add IF NOT EXISTS config for migrator Oct 8, 2023
@jinzhu
Copy link
Member

jinzhu commented Oct 26, 2023

you can use AutoMigrate in this case, and this pr seems doesn't works as explained, so going to close it for now.

@jinzhu jinzhu closed this Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants