Merge pull request #2677 from aignatov-bio/ai-sci-4783-add-migration-for-repository-state

Add migration for repository states [SCI-4783]
This commit is contained in:
aignatov-bio 2020-06-24 11:08:52 +02:00 committed by GitHub
commit 9694d4016f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,25 @@
# frozen_string_literal: true
class RepositoryTableStateUpdate < ActiveRecord::Migration[6.0]
class TempStateModel < ApplicationRecord
self.table_name = 'repository_table_states'
end
def up
TempStateModel.find_each do |table_state|
state = table_state.state
order_state = state['order'][0][0]
state['order'][0][0] = order_state + 2 if order_state > 5
2.times do
state['columns'].insert(6,
'search' => {
'regex' => false, 'smart' => true, 'search' => '', 'caseInsensitive' => true
},
'visible' => false)
end
state['ColReorder'] = state['ColReorder'].map { |i| i > 5 ? i + 2 : i } + [6, 7]
table_state.update(state: state)
end
end
end

View file

@ -7266,7 +7266,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200326114643'),
('20200331183640'),
('20200603125407'),
('20200604210943');
('20200604210943'),
('20200622155632');