Sha256: 6ecb89cf4059108b654502521e633be64e26f7528a501651432fdef1b1b1e84b

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

class CreateProclaimSubscriptions < ActiveRecord::Migration
	def change
		create_table :proclaim_subscriptions do |t|
			t.belongs_to :post, index: true
			t.string :email

			t.timestamps null: false
		end

		add_foreign_key :proclaim_subscriptions, :posts

		# This ensures that even if two clients try to create the same
		# subscription at exactly the same time, the database won't accept
		# one of them (Rails would have)
		add_index :proclaim_subscriptions, [:post_id, :email], :unique => true
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
proclaim-0.1.2 db/migrate/20141210234057_create_proclaim_subscriptions.rb
proclaim-0.1.1 db/migrate/20141210234057_create_proclaim_subscriptions.rb
proclaim-0.1.0 db/migrate/20141210234057_create_proclaim_subscriptions.rb