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.14.8 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.7 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.6 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.5 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.4 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.3 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.2 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.1 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.14.0 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.13.1 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.13.0 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.9 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.8 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.7 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.6 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.5 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.4 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.3 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.2 db/migrate/20140306161532_create_delivered_messages.rb
think_feel_do_engine-3.12.1 db/migrate/20140306161532_create_delivered_messages.rb