Sha256: a58c79d289ef6a7dda8f3f8f7f9fb14e168029230c078c4a244b1246f89f239f

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

# Migration responsible for creating a table with notifications
class CreateActivityNotificationTables < ActiveRecord::Migration[5.1]
  # Create tables
  def change
    create_table :notifications do |t|
      t.belongs_to :target,     polymorphic: true, index: true, null: false
      t.belongs_to :notifiable, polymorphic: true, index: true, null: false
      t.string     :key,                                        null: false
      t.belongs_to :group,      polymorphic: true, index: true
      t.integer    :group_owner_id,                index: true
      t.belongs_to :notifier,   polymorphic: true, index: true
      t.text       :parameters
      t.datetime   :opened_at

      t.timestamps
    end

    create_table :subscriptions do |t|
      t.belongs_to :target,     polymorphic: true, index: true, null: false
      t.string     :key,                           index: true, null: false
      t.boolean    :subscribing,                                null: false, default: true
      t.boolean    :subscribing_to_email,                       null: false, default: true
      t.datetime   :subscribed_at
      t.datetime   :unsubscribed_at
      t.datetime   :subscribed_to_email_at
      t.datetime   :unsubscribed_to_email_at
      t.text       :optional_targets

      t.timestamps
    end
    add_index :subscriptions, [:target_type, :target_id, :key], unique: true
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activity_notification-1.6.1 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.6.0 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.5.1 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.5.0 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.4.4 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.4.3 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.4.2 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.4.1 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
activity_notification-1.4.0 spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb