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

协同开发执行up 的时候发现 no change #259

Closed
cyrnicolase opened this issue Aug 7, 2019 · 2 comments
Closed

协同开发执行up 的时候发现 no change #259

cyrnicolase opened this issue Aug 7, 2019 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@cyrnicolase
Copy link

Describe the Bug
多人一起开发各自都生成迁移文件,执行up 有先后。如果先创建迁移文件的人后执行会出现 no change

Steps to Reproduce
比如有两个人一起开发项目;

  1. A 创建了一个迁移:
20190807165830_alter_users_add_column_phone.up.sql
20190807165830_alter_users_add_column_phone.down.sql
  1. B 也创建了一个迁移:
20190807165833_alter_users_add_column_gender.up.sql
20190807165833_alter_users_add_column_gender.down.sql
  1. B 执行数据库迁移 up()
正常执行
  1. A 执行数据库迁移 up()
2019/08/07 17:25:08 no change
2019/08/07 17:25:08 Finished after 616.022µs
2019/08/07 17:25:08 Closing source and database

如上,B 后于 A 创建;但是B 先执行了 UP() 操作;这个时候,A 再执行的时候就会出现 no change 的问题。
因为A 执行up 的时候系统发现 20190807165830_alter_users_add_column_phone.up.sql 的版本低于最新迁移版本。

Expected Behavior
希望能够将历史迁移版本都存储下来,可以将待迁移文件版本与历史版本比对。如果待迁移版本不存在历史版本中,就执行迁移。

Migrate Version
4.5.0

Loaded Source Drivers
file

Loaded Database Drivers
postgres

Go Version
go version go1.12.7 linux/amd64

@dhui
Copy link
Member

dhui commented Aug 8, 2019

Hi, please create issues in English.

I plugged the text into Google translate and I think you're referring to issues where multiple people create migrations at the same time.

This is a known issue but we haven't decided on the best solution for it yet. My latest summary of the goals for the solutions are here: #179 (comment)

Closing this issue in favor of the others. Feel free the reopen if Google translate completely messed up and you're actually raising a different issue.

@dhui dhui closed this as completed Aug 8, 2019
@dhui dhui added the duplicate This issue or pull request already exists label Aug 8, 2019
@cyrnicolase
Copy link
Author

ok, thank you , i found it here. https://github.com/rubenv/sql-migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants