mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-28 02:27:57 +08:00
Fix migration
This commit is contained in:
parent
5964a1b1f4
commit
cb5baa3d13
1 changed files with 6 additions and 1 deletions
|
@ -4,7 +4,12 @@ class ConvertActivitiesJsonToJsonb < ActiveRecord::Migration[5.2]
|
|||
def change
|
||||
change_column :activities, :values, 'jsonb USING CAST(values AS jsonb)'
|
||||
ActiveRecord::Base.connection.execute("
|
||||
UPDATE activities SET values = REGEXP_REPLACE(values::text, '^\"||\"$||\\\\', '', 'g')::jsonb
|
||||
UPDATE activities SET
|
||||
values = REGEXP_REPLACE(
|
||||
REGEXP_REPLACE(
|
||||
REGEXP_REPLACE(values::text, '\\\\\"', '\"', 'g'),
|
||||
'^\"||\"$', '', 'g'),
|
||||
'\\\\\\\\', '\\\\', 'g')::jsonb
|
||||
")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue