aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorTravis Jeffery <travisjeffery@gmail.com>2012-03-07 05:14:35 +0000
committerTravis Jeffery <travisjeffery@gmail.com>2012-03-07 17:55:33 +0000
commit8dc1a625c87950f4b258b7f6fc1036e08b192daa (patch)
treed60bcf733d3a140e0910b5422dc1427ef6bcd469 /activerecord/lib
parent577971f05a838da3ba74ba49d776a83f6bfe1aee (diff)
downloadrails-8dc1a625c87950f4b258b7f6fc1036e08b192daa.tar.gz
rails-8dc1a625c87950f4b258b7f6fc1036e08b192daa.tar.bz2
rails-8dc1a625c87950f4b258b7f6fc1036e08b192daa.zip
Adds #create/drop_schema on the PostgreSQL Adapter.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index f4efaa9b20..5b7fa029da 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -989,6 +989,16 @@ module ActiveRecord
SQL
end
+ # Creates a schema for the given schema name.
+ def create_schema schema_name
+ execute "CREATE SCHEMA #{schema_name}"
+ end
+
+ # Drops the schema for the given schema name.
+ def drop_schema schema_name
+ execute "DROP SCHEMA #{schema_name} CASCADE"
+ end
+
# Sets the schema search path to a string of comma-separated schema names.
# Names beginning with $ have to be quoted (e.g. $user => '$user').
# See: http://www.postgresql.org/docs/current/static/ddl-schemas.html