Sha256: 329e8f9a90052d3ecd4bb955f96825724eee98ac1bc76b7c5ddb1435aa19a9cf
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true class CreateRatingTables < ActiveRecord::Migration[5.0] def change create_table :rating_rates do |t| t.decimal :value, default: 0, precision: 17, scale: 14 t.references :author , index: true, null: false, polymorphic: true t.references :resource, index: true, null: false, polymorphic: true t.timestamps null: false end add_index :rating_rates, %i[author_id author_type resource_id resource_type], name: :index_rating_rates_on_author_and_resource, unique: true create_table :rating_ratings do |t| t.decimal :average , default: 0, mull: false, precision: 17, scale: 14 t.decimal :estimate, default: 0, mull: false, precision: 17, scale: 14 t.integer :sum , default: 0, mull: false t.integer :total , default: 0, mull: false t.references :resource, index: true, null: false, polymorphic: true t.timestamps null: false end add_index :rating_ratings, %i[resource_id resource_type], unique: true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rating-0.1.0 | lib/generators/rating/templates/db/migrate/create_rating_tables.rb |