Sha256: 4c4662767f53f22750b6328f6519648a87d040b9076cc916d5d2b72742c53d46

Contents?: true

Size: 760 Bytes

Versions: 68

Compression:

Stored size: 760 Bytes

Contents

class CreateDeliveredMessages < ActiveRecord::Migration
  def change
    create_table :delivered_messages do |t|
      t.references :message, index: true, null: false
      t.references :recipient, polymorphic: true, index: true, null: false
      t.boolean :is_read, default: false, null: false

      t.timestamps
    end

    reversible do |dir|
      dir.up do
        execute <<-SQL
          ALTER TABLE delivered_messages
            ADD CONSTRAINT fk_delivered_message_message
            FOREIGN KEY (message_id)
            REFERENCES messages(id)
        SQL
      end

      dir.down do
        execute <<-SQL
          ALTER TABLE delivered_messages
            DROP CONSTRAINT fk_delivered_message_message
        SQL
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.12.0 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.11.3 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.11.0 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.10.10 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.10.9 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.10.8 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.10.7 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.10.6 db/migrate/20140306161532_create_delivered_messages.rb