Commit 9618141d authored by sue445's avatar sue445

Fix. db:migrate is failed on MySQL 8

```
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system = true AND note LIKE '\_%\_'' at line 1: UPDATE notes SET note = trim(both '_' from note) WHERE system = true AND note LIKE '\_%\_'
```
parent e8fe08fc
---
title: Fix. `db:migrate` is failed on MySQL 8
merge_request: 28351
author: sue445
type: fixed
......@@ -7,7 +7,8 @@
# mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666
class ConvertLegacyReferenceNotes < ActiveRecord::Migration[4.2]
def up
execute %q{UPDATE notes SET note = trim(both '_' from note) WHERE system = true AND note LIKE '\_%\_'}
quoted_column_name = ActiveRecord::Base.connection.quote_column_name('system')
execute %Q{UPDATE notes SET note = trim(both '_' from note) WHERE #{quoted_column_name} = true AND note LIKE '\_%\_'}
end
def down
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment