mattermost / migration-assist

A helper tool to automate MySQL -> Postgres migration for Mattermost
https://docs.mattermost.com/deploy/postgres-migration.html
2 stars 2 forks source link

Simplify unicode fixes by removing the check for the column #15

Closed isacikgoz closed 3 months ago

isacikgoz commented 3 months ago

Summary

While doing the check we already check if the table.column exists or not so we are not required to run that check again. This will simplify the query and also would avoid errors (happened to a user).

agnivade commented 3 months ago

Can you clarify where do we already do the table.column check? Also, how would it avoid errors? Is there a bug here by checking the table.column again?

isacikgoz commented 3 months ago

@agnivade we are anyway running checks and this is the procedure for that: https://github.com/mattermost/migration-assist/blob/main/queries/procedures/create_unicode_check.sql

The bug was due to the error:

An Error Occurred: error during running unicode checks for mysql: error while trying to fix posts.props error: Error 3140 (22032): Invalid JSON text: "Invalid escape character in string." at position 407 in value for column 'Posts.Props'.

Where we generate the fix query from a prepared statement. The escape sequences getting bugged if there are two \ (backslashes) in the JSON.

agnivade commented 3 months ago

Yeah, the escaping is wrong.