aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb5
-rw-r--r--db/migrate/20131024114346_create_info_request_batches.rb22
-rw-r--r--db/migrate/20131024152540_add_body_to_info_request_batches.rb11
-rw-r--r--db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb8
-rw-r--r--db/migrate/20131127135622_add_sent_at_to_info_request_batch.rb5
-rw-r--r--db/migrate/20131211152641_create_public_body_change_requests.rb20
6 files changed, 71 insertions, 0 deletions
diff --git a/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb b/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb
new file mode 100644
index 000000000..cc9d8e76f
--- /dev/null
+++ b/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb
@@ -0,0 +1,5 @@
+class AddCanMakeBatchRequestsToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :can_make_batch_requests, :boolean, :default => false, :null => false
+ end
+end
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
diff --git a/db/migrate/20131024152540_add_body_to_info_request_batches.rb b/db/migrate/20131024152540_add_body_to_info_request_batches.rb
new file mode 100644
index 000000000..5f9b3af10
--- /dev/null
+++ b/db/migrate/20131024152540_add_body_to_info_request_batches.rb
@@ -0,0 +1,11 @@
+class AddBodyToInfoRequestBatches < ActiveRecord::Migration
+ def up
+ add_column :info_request_batches, :body, :text
+ add_index :info_request_batches, [:user_id, :body, :title]
+ end
+
+ def down
+ remove_column :info_request_batches, :body
+ end
+
+end
diff --git a/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb b/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb
new file mode 100644
index 000000000..11a9c7066
--- /dev/null
+++ b/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb
@@ -0,0 +1,8 @@
+class CreateInfoRequestBatchPublicBodiesJoinTable < ActiveRecord::Migration
+ def change
+ create_table :info_request_batches_public_bodies, :id => false do |t|
+ t.integer :info_request_batch_id
+ t.integer :public_body_id
+ end
+ end
+end
diff --git a/db/migrate/20131127135622_add_sent_at_to_info_request_batch.rb b/db/migrate/20131127135622_add_sent_at_to_info_request_batch.rb
new file mode 100644
index 000000000..27d4aecee
--- /dev/null
+++ b/db/migrate/20131127135622_add_sent_at_to_info_request_batch.rb
@@ -0,0 +1,5 @@
+class AddSentAtToInfoRequestBatch < ActiveRecord::Migration
+ def change
+ add_column :info_request_batches, :sent_at, :datetime
+ end
+end
diff --git a/db/migrate/20131211152641_create_public_body_change_requests.rb b/db/migrate/20131211152641_create_public_body_change_requests.rb
new file mode 100644
index 000000000..e3fb560a6
--- /dev/null
+++ b/db/migrate/20131211152641_create_public_body_change_requests.rb
@@ -0,0 +1,20 @@
+class CreatePublicBodyChangeRequests < ActiveRecord::Migration
+ def up
+ create_table :public_body_change_requests do |t|
+ t.column :user_email, :string
+ t.column :user_name, :string
+ t.column :user_id, :integer
+ t.column :public_body_name, :text
+ t.column :public_body_id, :integer
+ t.column :public_body_email, :string
+ t.column :source_url, :text
+ t.column :notes, :text
+ t.column :is_open, :boolean, :null => false, :default => true
+ t.timestamps
+ end
+ end
+
+ def down
+ drop_table :public_body_change_requests
+ end
+end