Commit 2f6fc74a authored by hh1966's avatar hh1966
Browse files

Update migration for body in research_plans to use JSONB

parent 57cdcb37
Pipeline #49827 failed with stage
......@@ -4,8 +4,6 @@ class ResearchPlan < ActiveRecord::Base
include Collectable
include Taggable
serialize :body, Array
belongs_to :creator, foreign_key: :created_by, class_name: 'User'
validates :creator, :name, presence: true
......
class AddBodyToResearchPlans < ActiveRecord::Migration
class ResearchPlan < ActiveRecord::Base
serialize :description, Hash
serialize :body, Array
end
def up
add_column :research_plans, :body, :text
add_column :research_plans, :body, :jsonb
ResearchPlan.find_each do |rp|
body = [
......@@ -48,7 +47,7 @@ class AddBodyToResearchPlans < ActiveRecord::Migration
rp.update_column(:description, rp.body[1]["value"])
end
remove_column :research_plans, :body
remove_column :research_plans, :jsonb
ResearchPlan.reset_column_information
end
......
......@@ -629,7 +629,7 @@ ActiveRecord::Schema.define(version: 20190716092051) do
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "body"
t.jsonb "body"
end
create_table "residues", force: :cascade do |t|
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment