Sha256: 6d448b87b0d9f4ca837e49eb186fcf61d724d9695b183def1c0f8ed499e18174

Contents?: true

Size: 810 Bytes

Versions: 7

Compression:

Stored size: 810 Bytes

Contents

class CreateSimpleNotifications < ActiveRecord::Migration[5.2]
  def change
    create_table(:simple_notifications) do |t|
      t.references :sender, polymorphic: true
      t.references :entity, polymorphic: true
      t.string :action
      t.string :message

      t.timestamps
    end

    create_table(:deliveries) do |t|
      t.references :simple_notification
      t.references :receiver, polymorphic: true
      t.boolean :is_delivered, default: false
      t.boolean :is_read, default: false

      t.timestamps
    end

    add_index(:simple_notifications, [:sender_id, :sender_type])
    add_index(:simple_notifications, [:entity_id, :entity_type])
    add_index(:deliveries, [:receiver_id, :receiver_type])
    add_index(:deliveries, :is_delivered)
    add_index(:deliveries, :is_read)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_notifications-1.2.5 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.2.4 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.2.3 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.2.2 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.2.1 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.9 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.8 lib/generators/simple_notifications/install/templates/migration.rb