Sha256: 111cda59b32c4185c4cdd356a5df655d3f0966d30c64e5dce209c41e52b4549a

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

class CreateNotifications < ActiveRecord::Migration
  def up

    unless table_exists? :notifications
      create_table :notifications do |t|
        t.string :type
        t.references :created_by
        t.text :message
        t.references :notification_type
        t.string :current_state

        t.timestamps
      end

      add_index :notifications, :notification_type_id
      add_index :notifications, :created_by_id
      add_index :notifications, :type
    end

    unless table_exists? :notification_types
      create_table :notification_types do |t|
        t.string :internal_identifier
        t.string :description

        t.timestamps
      end

      add_index :notification_types, :internal_identifier
    end

  end

  def down
    drop_table :notifications if table_exists? :notifications
    drop_table :notification_types if table_exists? :notification_types
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
erp_tech_svcs-4.0.0 db/migrate/20130610163240_create_notifications.rb