Sha256: 2b5735c998203f3818dea1fd0e1c081e21e09e746dff5fab92b6bfc6ef61186c

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

# Generated by Notifykit.
#
# Create a notifications table for managing emails and site notifications.
class CreateNotifications < ActiveRecord::Migration
  def self.up
    create_table :notifications do |t|
      t.string :category
      t.boolean :promotional, default: false
      t.boolean :transactional, default: true
      t.boolean :do_not_track, default: false
      t.boolean :deliver_via_site, default: true
      t.boolean :deliver_via_email, default: true
      t.string :kind
      t.string :token
      t.integer :user_id
      t.integer :subject_id
      t.string :subject_type
      t.datetime :read_at
      t.datetime :clicked_at
      t.datetime :ignored_at
      t.datetime :cancelled_at
      t.datetime :unsubscribed_at
      t.datetime :email_sent_at
      t.datetime :email_marked_as_spam_at
      t.datetime :email_returned_at
      t.datetime :email_not_sent_at
      t.string :email_not_sent_reason
      t.string :email
      t.string :email_reply_to
      t.string :email_from
      t.string :email_subject
      t.text :email_urls
      t.text :email_text
      t.text :email_html
      t.integer :click_count, default: 0
      t.integer :read_count, default: 0
      t.text :data
      t.timestamps
    end

    add_index :notifications, :token, unique: true
    add_index :notifications, :created_at
    add_index :notifications, [:id, :created_at, :read_at, :clicked_at, :ignored_at, :cancelled_at], name: 'recent'
    add_index :notifications, :kind
    add_index :notifications, :category
    add_index :notifications, :user_id
    add_index :notifications, [:subject_id, :subject_type], name: 'subject'
  end

  def self.down
    drop_table :notifications
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notifykit-0.3.0 lib/generators/notifykit/templates/db/migrate/create_notifications.rb
notifykit-0.2.0 lib/generators/notifykit/templates/db/migrate/create_notifications.rb
notifykit-0.1.0 lib/generators/notifykit/templates/db/migrate/create_notifications.rb