aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorLuc Donnet2018-04-05 17:51:30 +0200
committerLuc Donnet2018-04-05 17:51:30 +0200
commitf4ee2c2d41930f94f600fe8f2ffbfc53d319d903 (patch)
tree39039141dcffadba4399456f3252fa238269818f /db/migrate
parent49ed5c442a18b1a339efa0d2a1bc7b3458148a14 (diff)
downloadchouette-core-f4ee2c2d41930f94f600fe8f2ffbfc53d319d903.tar.bz2
Fix custom_fields migration on company to convert json to jsonb Refs #6426 @1
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180405133659_change_companies_custom_fields_values_type.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/db/migrate/20180405133659_change_companies_custom_fields_values_type.rb b/db/migrate/20180405133659_change_companies_custom_fields_values_type.rb
index b2b6804c7..7248c29f6 100644
--- a/db/migrate/20180405133659_change_companies_custom_fields_values_type.rb
+++ b/db/migrate/20180405133659_change_companies_custom_fields_values_type.rb
@@ -1,5 +1,8 @@
class ChangeCompaniesCustomFieldsValuesType < ActiveRecord::Migration
def change
- change_column :companies, :custom_field_values, :jsonb
+ reversible do |dir|
+ dir.up { change_column :companies, :custom_field_values, 'jsonb USING CAST(custom_field_values AS jsonb)', :default => {} }
+ dir.down { change_column :companies, :custom_field_values, 'json USING CAST(custom_field_values AS json)', :default => {} }
+ end
end
end