2019-10-03 20:06:47 -03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-05-17 22:38:26 -03:00
|
|
|
class CreateRatingTable < ActiveRecord::Migration[7.0]
|
2019-10-03 20:06:47 -03:00
|
|
|
def change
|
|
|
|
create_table :rating_ratings do |t|
|
|
|
|
t.decimal :average, default: 0, mull: false, precision: 25, scale: 16
|
|
|
|
t.decimal :estimate, default: 0, mull: false, precision: 25, scale: 16
|
2022-05-18 10:11:50 -03:00
|
|
|
t.bigint :sum, default: 0, mull: false
|
|
|
|
t.bigint :total, default: 0, mull: false
|
2019-10-03 20:06:47 -03:00
|
|
|
|
|
|
|
t.references :resource, index: true, null: false, polymorphic: true
|
|
|
|
t.references :scopeable, index: true, null: true, polymorphic: true
|
|
|
|
|
2022-05-17 23:50:53 -03:00
|
|
|
t.timestamps
|
2019-10-03 20:06:47 -03:00
|
|
|
end
|
|
|
|
|
|
|
|
change_column :rating_ratings, :resource_type, :string, limit: 10
|
|
|
|
change_column :rating_ratings, :scopeable_type, :string, limit: 10
|
|
|
|
end
|
|
|
|
end
|