2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-31 00:06:56 -04:00
|
|
|
class FixEmojiPath < ActiveRecord::Migration[4.2]
|
2014-12-11 11:08:47 -05:00
|
|
|
BASE_URL = '/plugins/emoji/images/'
|
|
|
|
|
|
|
|
def up
|
|
|
|
execute <<-SQL
|
|
|
|
UPDATE posts
|
|
|
|
SET cooked = REPLACE(cooked, '#{BASE_URL}', '#{BASE_URL}emoji_one/')
|
|
|
|
WHERE cooked LIKE '%#{BASE_URL}%'
|
|
|
|
SQL
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
execute <<-SQL
|
|
|
|
UPDATE posts
|
|
|
|
SET cooked = REPLACE(cooked, '#{BASE_URL}emoji_one/', '#{BASE_URL}')
|
|
|
|
WHERE cooked LIKE '%#{BASE_URL}emoji_one/%'
|
|
|
|
SQL
|
|
|
|
end
|
|
|
|
end
|