From 9618141dc73ce24da521e2305eed613889879d73 Mon Sep 17 00:00:00 2001 From: sue445 Date: Thu, 16 May 2019 17:19:17 +0900 Subject: 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 '\_%\_' ``` --- db/migrate/20150509180749_convert_legacy_reference_notes.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'db') diff --git a/db/migrate/20150509180749_convert_legacy_reference_notes.rb b/db/migrate/20150509180749_convert_legacy_reference_notes.rb index a44a908c2f5..84d4eb9e51f 100644 --- a/db/migrate/20150509180749_convert_legacy_reference_notes.rb +++ b/db/migrate/20150509180749_convert_legacy_reference_notes.rb @@ -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 -- cgit v1.2.3