Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hh1966
chemotion_eln_server
Commits
2f6fc74a
Commit
2f6fc74a
authored
Jul 16, 2019
by
hh1966
Browse files
Update migration for body in research_plans to use JSONB
parent
57cdcb37
Pipeline
#49827
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/models/research_plan.rb
View file @
2f6fc74a
...
...
@@ -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
...
...
db/migrate/20190716092051_add_body_to_research_plans.rb
View file @
2f6fc74a
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
...
...
db/schema.rb
View file @
2f6fc74a
...
...
@@ -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
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment