instance method
drop_enum
Ruby on Rails 8.1.2
Since v7.1.6Signature
drop_enum(name, values = nil, **options)
Drops an enum type.
If the if_exists: true option is provided, the enum is dropped only if it exists. Otherwise, if the enum doesn’t exist, an error is raised.
The values parameter will be ignored if present. It can be helpful to provide this in a migration’s change method so it can be reverted. In that case, values will be used by #create_enum.
Parameters
-
namereq -
valuesopt = nil -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 586
def drop_enum(name, values = nil, **options)
query = <<~SQL
DROP TYPE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(name)};
SQL
internal_exec_query(query).tap { reload_type_map }
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb line 586
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter