Sha256: 215b1e434ae2925ca3bf1ccbf6c0acbc435fb170c6944c13d04ad6df66f53fee

Contents?: true

Size: 430 Bytes

Versions: 178

Compression:

Stored size: 430 Bytes

Contents

class AddPositionToCommons < ActiveRecord::Migration[5.2]
  def change
    add_column :educode_sales_permissions, :position, :integer
    EducodeSales::Permission.all.each_with_index do |d,index|
      if d.clazz == '销售态势' || d.clazz == '销售分工' || d.clazz == '商机管理' || d.clazz == '客户管理'
        d.update(position: index)
      else
        d.update(position: index * 10)
      end
    end
  end
end

Version data entries

178 entries across 178 versions & 1 rubygems

Version Path
educode_sales-0.9.72 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.71 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.70 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.69 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.68 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.67 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.66 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.65 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.64 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.63 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.62 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.61 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.60 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.59 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.58 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.57 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.56 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.55 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.54 db/migrate/20211220102720_add_position_to_commons.rb
educode_sales-0.9.53 db/migrate/20211220102720_add_position_to_commons.rb