diff options
author | Ricardo <ricardo.wurmus@gmail.com> | 2012-02-04 08:45:13 +0400 |
---|---|---|
committer | Ricardo <ricardo.wurmus@gmail.com> | 2012-02-04 08:45:13 +0400 |
commit | 6fa548e4277d568a301979e7f0ebd6e42efd4828 (patch) | |
tree | c0b60d1ca11bb80a359b18b3d5afbf8e67c76454 /db | |
parent | 354ed7ef05e4235d69300252dcace85f4ee07726 (diff) |
fix syntax for psql backend
- PostgreSQL doesn't allow double quotes for values. Double quotes are
used for surrounding table names that contain spaces. Single quotes
should be used for values.
- DELETE in a JOIN is not permitted in SQL-99 (see
http://drupal.org/node/555562) so we use USING with WHERE instead
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20120202190701_remove_public_share_visibilities.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/db/migrate/20120202190701_remove_public_share_visibilities.rb b/db/migrate/20120202190701_remove_public_share_visibilities.rb index db3bcfb48..a884c8825 100644 --- a/db/migrate/20120202190701_remove_public_share_visibilities.rb +++ b/db/migrate/20120202190701_remove_public_share_visibilities.rb @@ -24,13 +24,13 @@ class RemovePublicShareVisibilities < ActiveRecord::Migration while index < shareable_size + 100 do sql = <<-SQL - DELETE sv + DELETE FROM share_visibilities AS sv - INNER JOIN #{table_name} - ON sv.shareable_id = #{table_name}.id - WHERE sv.shareable_type = "#{type}" - AND #{table_name}.public IS TRUE - AND #{table_name}.id < #{index}; + USING #{table_name} as p + WHERE sv.shareable_id = p.id + AND sv.shareable_type = '#{type}' + AND p.public IS TRUE + AND p.id < #{index}; SQL puts "deleted public share vis up to #{index} of #{type}" |