10

How it started:

Need to replace in a lot of SQL files certain stuff...

find . -type f -iname '*.sql' -exec sed -i 's|new|old|g' {} \;

12 hours later that find executed a shell script containing roughly 120 lines of text pipelining.

The jolly of inconsistent workflows.

Different SQL format stylings... Makes fun when single line string replace needs to be extended to multiline RegEx handling. Or matching SQL comment configuration..

Different line endings. MacOS, Windows, Unix, Bukkake.

Different charsets / collations. Anyone wants latin1_swedish_ci... utf8... utf16... :/

Realizing some people even left sensitive data inside the SQL files (e.g. API Tokens..... Yayyyyyyy).

...

Ugh. It's never a one liner. It's never easy. -.-

I hate cleaning up messy shit.

Comments
  • 3
    We be rollin...
  • 2
    Hmmm.

    import everything into a local sql server instance, and massage the data in there? export when done?

    It Should be faster, and simpler to handle the edge cases.
  • 3
    @magicMirror

    It's the other way around... I needed to make sure that the settings are consistent before I can dump them in an SQL server.

    Large part of it were database evolutions / migrations, so I must leave them as is regarding file hierarchy.

    Plus changing collations / charset after importing is a painful fun in MySQL.

    E.g. breaking full text indices, needing to triple check everything, etc. etc.
Add Comment