+ def drop_enumeration(enumeration_name)
+ execute "DROP TYPE #{enumeration_name}"
+ enumerations.delete(enumeration_name)
+ end
+
+ def rename_enumeration(old_name, new_name)
+ execute "ALTER TYPE #{quote_table_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
+ end
+
+ def alter_primary_key(table_name, new_columns)
+ execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{table_name}_pkey"
+ execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{new_columns.join(',')})"
+ end
+
+ def interval_constant(interval)
+ "'#{interval}'::interval"
+ end
+
+ def add_index(table_name, column_name, options = {})
+ column_names = Array(column_name)
+ index_name = index_name(table_name, :column => column_names)
+
+ if Hash === options # legacy support, since this param was a string
+ index_type = options[:unique] ? "UNIQUE" : ""
+ index_name = options[:name] || index_name
+ index_method = options[:method] || "BTREE"
+ else
+ index_type = options