Sha256: fb641de7231971e903c26a6cf3e94f7249f8901bd670ba6b55c6fb17f04e2604

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 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 :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, [:sender_id, :sender_type])
    add_index(:deliveries, :is_delivered)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_notifications-1.1.1 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.0 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.0.4 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.0.3 lib/generators/simple_notifications/install/templates/migration.rb