mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-27 09:13:46 +08:00
Add migration for repository states
This commit is contained in:
parent
47aac74719
commit
0fe4ee0eae
2 changed files with 22 additions and 2 deletions
20
db/migrate/20200622155632_repository_table_state_update.rb
Normal file
20
db/migrate/20200622155632_repository_table_state_update.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RepositoryTableStateUpdate < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
RepositoryTableState.all.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
|
|
@ -7266,7 +7266,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||
('20200326114643'),
|
||||
('20200331183640'),
|
||||
('20200603125407'),
|
||||
('20200604210943');
|
||||
|
||||
('20200604210943'),
|
||||
('20200622155632');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue