]> git.openstreetmap.org Git - rails.git/blobdiff - lib/migrate.rb
Handle differences in interval constant formatting.
[rails.git] / lib / migrate.rb
index 488c6d3d2a36eb5a3d39521b055b974d79241704..392060b6015a8cdb34d5fcfa6172e8a215b05eb4 100644 (file)
@@ -98,6 +98,10 @@ module ActiveRecord
       def alter_primary_key(table_name, new_columns)
         execute("alter table #{table_name} drop primary key, add primary key (#{new_columns.join(',')})")
       end
+
+      def interval_constant(interval)
+        "'#{interval}'"
+      end
     end
 
     class PostgreSQLAdapter
@@ -150,6 +154,10 @@ module ActiveRecord
       def alter_primary_key(table_name, new_columns)
         execute "alter table #{table_name} drop constraint #{table_name}_pkey; alter table #{table_name} add primary key (#{new_columns.join(',')})"
       end
+
+      def interval_constant(interval)
+        "'#{interval}'::interval"
+      end
     end
   end
 end