instance method drop_database

Ruby on Rails edge

Since edge

Signature

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

name req
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

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close