Sha256: 5b551f2b92897f58c68a99ffa09c6a110bfee786eeb2840553ed7fb50ed9fdd9
Contents?: true
Size: 909 Bytes
Versions: 1
Compression:
Stored size: 909 Bytes
Contents
# frozen_string_literal: true class CreateRatingTable < ActiveRecord::Migration[5.0] def change create_table :rating_ratings do |t| t.decimal :average, default: 0, mull: false, precision: 11, scale: 2 t.decimal :estimate, default: 0, mull: false, precision: 11, scale: 2 t.integer :sum, default: 0, mull: false t.integer :total, default: 0, mull: false t.references :resource, index: true, null: false, polymorphic: true t.references :scopeable, index: true, null: true, polymorphic: true t.timestamps null: false end change_column :rating_ratings, :resource_type, :string, limit: 10 change_column :rating_ratings, :scopeable_type, :string, limit: 10 add_index :rating_ratings, %i[resource_type resource_id scopeable_type scopeable_id], name: :index_rating_rating_on_resource_and_scopeable, unique: true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rating-1.0.0 | lib/generators/rating/templates/db/migrate/create_rating_table.rb |