aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorfrancis <francis>2008-03-24 09:35:23 +0000
committerfrancis <francis>2008-03-24 09:35:23 +0000
commit5dccf065dbff50587d2c235eeac28ed98e87d53e (patch)
treee59e09fa4f4628b03cbfe169a0a0d27dc8b17453 /db/migrate
parent788ddd480c7c131a5c04d0923ccb354a545c39b1 (diff)
Send email to remind people to classify their response.
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/046_add_last_event_id_to_alert_table.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/046_add_last_event_id_to_alert_table.rb b/db/migrate/046_add_last_event_id_to_alert_table.rb
new file mode 100644
index 000000000..4e67fee5b
--- /dev/null
+++ b/db/migrate/046_add_last_event_id_to_alert_table.rb
@@ -0,0 +1,13 @@
+class AddLastEventIdToAlertTable < ActiveRecord::Migration
+ def self.up
+ add_column :user_info_request_sent_alerts, :info_request_event_id, :integer, :default => nil
+ execute "ALTER TABLE user_info_request_sent_alerts ADD CONSTRAINT fk_user_info_request_sent_alert_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id)"
+ # The coalesce is because null values are considred not equal in SQL, and we want them
+ # to be considered equal for the purposes of this index.
+ execute "create unique index user_info_request_sent_alerts_unique_index on user_info_request_sent_alerts (user_id, info_request_id, alert_type, coalesce(info_request_event_id, -1))"
+ end
+
+ def self.down
+ remove_column :user_info_request_sent_alerts, :info_request_event_id
+ end
+end