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

Some changes to hopefully make generating structure.sql easier. #4405

Merged
merged 1 commit into from Aug 4, 2019

Conversation

@jfly
Copy link
Member

commented Aug 4, 2019

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.

@@ -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 */

This comment has been minimized.

Copy link
@jonatanklosko

jonatanklosko Aug 4, 2019

Member

Interestingly this doesn't seem to happen for me:

image

This comment has been minimized.

Copy link
@jfly

jfly Aug 4, 2019

Author Member

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.

This comment has been minimized.

Copy link
@jonatanklosko

jonatanklosko Aug 4, 2019

Member

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 =)

This comment has been minimized.

Copy link
@jfly

jfly Aug 4, 2019

Author Member

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 =)

This comment has been minimized.

Copy link
@jonatanklosko

jonatanklosko Aug 4, 2019

Member

I think the only difference with multiline regexps is that . additionally match newline characters, but you can always use them explicitly =)

@jonatanklosko
Copy link
Member

left a comment

LGTM, thanks!

Some changes to hopefully make generating structure.sql easier.
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.

@jfly jfly force-pushed the jfly:easier-db-dumps branch from 7f0d6de to 8163859 Aug 4, 2019

@jfly jfly merged commit a605db1 into thewca:master Aug 4, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 96.301%
Details

@jfly jfly deleted the jfly:easier-db-dumps branch Aug 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.