aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/alert.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mauve/alert.rb')
-rw-r--r--lib/mauve/alert.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb
index e8647f7..4cee65f 100644
--- a/lib/mauve/alert.rb
+++ b/lib/mauve/alert.rb
@@ -30,18 +30,20 @@ module Mauve
the_distant_future = (Time.now + 2000.days).to_i # it is the year 2000 - the humans are dead
case DataMapper.repository(:default).adapter.class.to_s
- when "DataMapper::Adapters::PostgresAdapter"
- ifnull = "COALESCE"
- min = "LEAST"
- else
- ifnull = "IFNULL"
- min = "MIN"
+ when "DataMapper::Adapters::PostgresAdapter"
+ ifnull = "COALESCE"
+ min = "LEAST"
+ drop_view = "DROP VIEW"
+ else
+ ifnull = "IFNULL"
+ min = "MIN"
+ # This was previously a DROP VIEW, but the sqlite adapter complains
+ # about DROP VIEW here.
+ drop_view = "DROP TABLE"
end
["BEGIN TRANSACTION",
- # This was previously a DROP VIEW, but the sqlite adapter complains
- # about DROP VIEW here.
- "DROP TABLE IF EXISTS mauve_alert_earliest_dates",
+ "#{drop_view} IF EXISTS mauve_alert_earliest_dates",
"CREATE VIEW
mauve_alert_earliest_dates
AS