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

Allow for adding options after the db name #129

Conversation

designvoid
Copy link
Contributor

This is useful for being able to use commands such as SED to edit the stream prior to being written to the dump file ie remove auto-increment values

This is useful for being able to use commands such as SED to edit the stream prior to being written to the dump file ie remove auto-increment values
@freekmurze
Copy link
Member

Could you explain the use case in more detail? Looking at the test you could achieve the same result by replacing that addExtraOptionAtEnd with a regular addExtraOption.

@designvoid
Copy link
Contributor Author

heya, yes, so I had a situation where I wanted to just dump the schema and additionally reset the auto-increment values of the tables. There is no flag for the auto-increment so the accepted way to do this is by editing the stream before it gets written to the file (https://bugs.mysql.com/bug.php?id=20786)

We have the same problem on some installations. I use the workaround via sed

mysqldump --defaults-file=logindata.rc --no-data --add-drop-table -h 127.0.0.1 my_database | sed --expression='s/ AUTO_INCREMENT=[0-9]\+//' | gzip > my_database_structure.sql.gz

So what this PR enables is the addition of placing the sed --expression='s/ AUTO_INCREMENT=[0-9]\+//' after the db name and before the >

@freekmurze
Copy link
Member

Rename it to addExtraOptionAfterDbName for extra clarity 👍

@designvoid
Copy link
Contributor Author

Changed as requested!

@designvoid
Copy link
Contributor Author

any movement on this @freekmurze ?

@freekmurze freekmurze merged commit e7a4d3c into spatie:master Apr 16, 2020
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants