From 0dff84cae0efda2cd8443433e21ce2bc40f94e37 Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Wed, 24 Jun 2020 09:51:24 +0200 Subject: [PATCH] Update migration --- db/migrate/20200622155632_repository_table_state_update.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/migrate/20200622155632_repository_table_state_update.rb b/db/migrate/20200622155632_repository_table_state_update.rb index 0a942fa53..b80497284 100644 --- a/db/migrate/20200622155632_repository_table_state_update.rb +++ b/db/migrate/20200622155632_repository_table_state_update.rb @@ -1,8 +1,12 @@ # frozen_string_literal: true class RepositoryTableStateUpdate < ActiveRecord::Migration[6.0] + class TempStateModel < ApplicationRecord + self.table_name = 'repository_table_states' + end + def up - RepositoryTableState.all.each do |table_state| + 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