9618141dc7
``` 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 '\_%\_' ```
17 lines
533 B
Ruby
17 lines
533 B
Ruby
# Convert legacy Markdown-emphasized notes to the current, non-emphasized format
|
|
#
|
|
# _mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666_
|
|
#
|
|
# becomes
|
|
#
|
|
# mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666
|
|
class ConvertLegacyReferenceNotes < ActiveRecord::Migration[4.2]
|
|
def up
|
|
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
|
|
# noop
|
|
end
|
|
end
|