Handle differences in interval constant formatting.
This commit is contained in:
parent
bb7c4f93e2
commit
a4de927a28
2 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue