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
Some changes to hopefully make generating structure.sql easier. #4405
Conversation
WcaOnRails/db/structure.sql
Outdated
@@ -1341,6 +1341,7 @@ CREATE TABLE `wcif_extensions` ( | |||
/*!50001 SET character_set_results = utf8mb4 */; | |||
/*!50001 SET collation_connection = utf8mb4_unicode_ci */; | |||
/*!50001 CREATE ALGORITHM=UNDEFINED */ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you asking why there's a blank space here on line 1344? That's because with these changes, we're now gsub
-ing away the DEFINER=
line, which leaves behind a blank line. It might be possible to get rid of the blank line (doing a multiline regex? something else?), but it seemed like it would be extra work with no real benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha! I believe it should be as simple as specifying \n
instead of line start ^
. I'm happy with either version, just wanted to ensure that I won't run into other weird diff locally =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dang, I wasn't expecting that to work, I thought I'd need to enable multiline regexes somehow...
Changed! Now there is no diff to structure.sql
=)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only difference with multiline regexps is that .
additionally match newline characters, but you can always use them explicitly =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
When running `bin/rake db:structure:dump`, I get two lines of diff in my `structure.sql` file: 1. Some trailing space is added to a `CREATE VIEW` declaration. - This is pretty harmless, but it is annoying to remove each time. 2. A `DEFINER=` line gets added before our `rails_persons` `VIEW`. - This one regularly causes pain, as it breaks `bin/rake db:reset` for some reason. This diff changes things so we remove these changes when dumping the database schema.
When running
bin/rake db:structure:dump
, I get two lines of diff in mystructure.sql
file:CREATE VIEW
declaration.DEFINER=
line gets added before ourrails_persons
VIEW
.bin/rake db:reset
for some reason.
This diff changes things so we remove these changes when dumping the
database schema.