- module PostgreSQL
- module Quoting
- def quote_column_name_with_arrays(name)
- Array(name).map { |n| quote_column_name_without_arrays(n) }.join(", ")
- end
+ module PostgreSQLAdapter
+ def quote_column_name(name)
+ Array(name).map { |n| super(n) }.join(", ")
+ end
+
+ def add_primary_key(table_name, column_name, _options = {})
+ table_name = quote_table_name(table_name)
+ column_name = quote_column_name(column_name)
+
+ execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{column_name})"
+ end
+
+ def remove_primary_key(table_name)
+ table_name = quote_table_name(table_name)