instance method
create_schema
Ruby on Rails 8.0.4
Since v4.2.9Signature
create_schema(schema_name, force: nil, if_not_exists: nil)
Creates a schema for the given schema name.
Parameters
-
schema_namereq -
forcekey = nil -
if_not_existskey = nil
Source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 256
def create_schema(schema_name, force: nil, if_not_exists: nil)
if force && if_not_exists
raise ArgumentError, "Options `:force` and `:if_not_exists` cannot be used simultaneously."
end
if force
drop_schema(schema_name, if_exists: true)
end
execute("CREATE SCHEMA#{' IF NOT EXISTS' if if_not_exists} #{quote_schema_name(schema_name)}")
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb line 256
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements