rating/spec/support/db/migrate/create_rates_table.rb

20 lines
668 B
Ruby
Raw Permalink Normal View History

2019-10-03 23:06:47 +00:00
# frozen_string_literal: true
class CreateRateTable < ActiveRecord::Migration[7.0]
2019-10-03 23:06:47 +00:00
def change
create_table :rating_rates do |t|
t.decimal :value, default: 0, precision: 25, scale: 16
t.references :author, index: true, null: false, polymorphic: true
t.references :resource, index: true, null: false, polymorphic: true
t.references :scopeable, index: true, null: true, polymorphic: true
2022-05-18 02:50:53 +00:00
t.timestamps
2019-10-03 23:06:47 +00:00
end
change_column :rating_rates, :author_type, :string, limit: 10
change_column :rating_rates, :resource_type, :string, limit: 10
change_column :rating_rates, :scopeable_type, :string, limit: 10
end
end