diff --git a/db/migrate/20191218022602_sort_to_project_categories_with_position.rb b/db/migrate/20191218022602_sort_to_project_categories_with_position.rb new file mode 100644 index 000000000..22a0e72cb --- /dev/null +++ b/db/migrate/20191218022602_sort_to_project_categories_with_position.rb @@ -0,0 +1,7 @@ +class SortToProjectCategoriesWithPosition < ActiveRecord::Migration[5.2] + def change + ProjectCategory.order(:updated_at).each.with_index(1) do |pc, index| + pc.update_column :position, index + end + end +end