diff options
author | sue445 <sue445@sue445.net> | 2019-05-16 11:19:17 +0300 |
---|---|---|
committer | sue445 <sue445@sue445.net> | 2019-05-16 12:58:56 +0300 |
commit | 9618141dc73ce24da521e2305eed613889879d73 (patch) | |
tree | 2bb718076e8f97f81b83f136451259ec624cab9d | |
parent | e8fe08fca2277b77f6e42a59ac8946b6cb9db098 (diff) |
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 '\_%\_'
```
-rw-r--r-- | changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml | 5 | ||||
-rw-r--r-- | db/migrate/20150509180749_convert_legacy_reference_notes.rb | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml b/changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml new file mode 100644 index 00000000000..63f134808e3 --- /dev/null +++ b/changelogs/unreleased/fix-db-migrate-is-failed-on-mysql8.yml @@ -0,0 +1,5 @@ +--- +title: Fix. `db:migrate` is failed on MySQL 8 +merge_request: 28351 +author: sue445 +type: fixed 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 |