- execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{quote_table_name(table_name + '_pkey')}"
- execute "ALTER TABLE #{quote_table_name(table_name)} ADD PRIMARY KEY (#{quote_column_name(new_columns)})"
+ constraint_name = quote_table_name("#{table_name}_pkey")
+ table_name = quote_table_name(table_name)
+ new_columns = quote_column_name(new_columns)
+
+ execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{constraint_name}"
+ execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{new_columns})"