diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-03-04 10:46:46 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-03-04 10:46:46 +0000 |
commit | ede46dc8dc6c97cdad8c3fcb3bd42ede5c25f395 (patch) | |
tree | 44e03358c9fa7ca6826e631d1d3d6c1030b1b0d5 /db/migrate/20131024114346_create_info_request_batches.rb | |
parent | 8e911d5bd0e60a0e0e4859868662cc176419d2e3 (diff) | |
parent | a38b2989aebf8d554b7287e18528bed8c9e67d3b (diff) |
Merge branch 'release/0.17'0.17
Diffstat (limited to 'db/migrate/20131024114346_create_info_request_batches.rb')
-rw-r--r-- | db/migrate/20131024114346_create_info_request_batches.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20131024114346_create_info_request_batches.rb b/db/migrate/20131024114346_create_info_request_batches.rb new file mode 100644 index 000000000..09c6f467b --- /dev/null +++ b/db/migrate/20131024114346_create_info_request_batches.rb @@ -0,0 +1,22 @@ +class CreateInfoRequestBatches < ActiveRecord::Migration + def up + create_table :info_request_batches do |t| + t.column :title, :text, :null => false + t.column :user_id, :integer, :null => false + t.timestamps + end + add_column :info_requests, :info_request_batch_id, :integer, :null => true + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + execute "ALTER TABLE info_requests + ADD CONSTRAINT fk_info_requests_info_request_batch + FOREIGN KEY (info_request_batch_id) REFERENCES info_request_batches(id)" + end + add_index :info_requests, :info_request_batch_id + add_index :info_request_batches, :user_id + end + + def down + remove_column :info_requests, :info_request_batch_id + drop_table :info_request_batches + end +end |