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

Improve mysqldump #23301

Merged
merged 1 commit into from Jun 17, 2016
Merged

Improve mysqldump #23301

merged 1 commit into from Jun 17, 2016

Conversation

@ppworks
Copy link
Contributor

ppworks commented Jan 28, 2016

After we running rake db:structure:dump in project members each other, there might have diff on db/structure.sql as below.

--- MySQL dump 10.13  Distrib 5.7.9, for osx10.9 (x86_64)
+-- MySQL dump 10.13  Distrib 5.6.23, for osx10.10 (x86_64)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB AUTO_INCREMENT=437 DEFAULT CHARSET=utf8;

Because default output of mysqldump includes comments like MySQL version and AUTO_INCREMENT default value and so on.

In addition, after we running rake db:migrate when we set config.active_record.schema_format=:sql in confing/application.rb, there might have different db/structure.sql as below.

--- Dump completed on 2016-01-28 13:34:00
+-- Dump completed on 2016-01-28 13:48:05

So, I added additional options to "mysqldump" command and I removed AUTO_INCREMENT default values from dumped SQL.

@rails-bot
Copy link

rails-bot commented Jan 28, 2016

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @sgrif (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@ppworks ppworks force-pushed the ppworks:improve_mysqldump branch Jan 28, 2016
@ppworks ppworks force-pushed the ppworks:improve_mysqldump branch 2 times, most recently Jan 28, 2016
@pixeltrix
Copy link
Member

pixeltrix commented Jan 28, 2016

For reference previous discussion about this: #8004

@ppworks ppworks force-pushed the ppworks:improve_mysqldump branch Jan 28, 2016
@ppworks
Copy link
Contributor Author

ppworks commented Jan 28, 2016

Thanks for your reference!
I deleted ppworks@5044db4 .

@ppworks
Copy link
Contributor Author

ppworks commented Jan 28, 2016

Thank you, I'll try to do this to avoid AUTO_INCREMENT diff.

@arthurnn
Copy link
Member

arthurnn commented Mar 7, 2016

@rails-bot rails-bot assigned arthurnn and unassigned sgrif Mar 7, 2016
@metaskills
Copy link
Contributor

metaskills commented May 18, 2016

So 👀 this issue.

@jeremy
Copy link
Member

jeremy commented May 19, 2016

Are --skip-comments and --skip-dump-date compatible with all MySQL 5.x? With MariaDB 5.x and 10.x?

@arthurnn
Copy link
Member

arthurnn commented Jun 16, 2016

I think if you skip-comments you dont need to skip-dump-date too. as the date is considered a comment.
At least I tested locally with skip-comment only and it worked.
Can you change to include only that?

@jeremy I see skip-comments on 5.5 https://dev.mysql.com/doc/refman/5.5/en/mysqldump.html#option_mysqldump_dump-date and maria https://mariadb.com/kb/en/mariadb/mysqldump/

@ppworks ppworks force-pushed the ppworks:improve_mysqldump branch to 941a735 Jun 17, 2016
@ppworks
Copy link
Contributor Author

ppworks commented Jun 17, 2016

@arthurnn Thanks for your review.

@arthurnn
Copy link
Member

arthurnn commented Jun 17, 2016

ありがとうございます

@arthurnn arthurnn merged commit 6d4df1d into rails:master Jun 17, 2016
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@jaredbeck
Copy link
Contributor

jaredbeck commented Apr 7, 2017

Am I understanding correctly that rails 5.1 will no longer include the AUTO_INCREMENT=123 comment in my structure.sql? If so, that is awesome.

knu added a commit to knu/git-merge-structure-sql that referenced this pull request Nov 30, 2018
Rails merged [this PR](rails/rails#23301) to
run mysqldump with `--skip-comments`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants
You can’t perform that action at this time.