instance method
drop_database
Ruby on Rails edge
Since edgeSignature
drop_database(name)
Drops a PostgreSQL database.
Example:
drop_database 'matt_development'
Note, for PostgreSQL versions >= 13 the SQL statement will include WITH (FORCE) to disconnect clients before dropping the database. This allows you to drop/reset the database without stopping the Rails server etc. See: www.postgresql.org/docs/current/sql-dropdatabase.html
Parameters
-
namereq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 63
def drop_database(name)
statement = "DROP DATABASE IF EXISTS #{quote_table_name(name)}"
statement += " WITH (FORCE)" if supports_force_drop_database?
execute statement
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb line 63
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements