Sha256: b8617eb0836578fef03964cb5f037e57085a8bcca00eae74d9c2e9a226c5b7cc

Contents?: true

Size: 787 Bytes

Versions: 6

Compression:

Stored size: 787 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, [:receiver_id, :receiver_type])
    add_index(:deliveries, :is_delivered)
    add_index(:deliveries, :is_read)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_notifications-1.1.7 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.6 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.5 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.4 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.3 lib/generators/simple_notifications/install/templates/migration.rb
simple_notifications-1.1.2 lib/generators/simple_notifications/install/templates/migration.rb