Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PostgreSQL's SchemaStatements seems a could candidate for re-use (wit…

…h AR-JDBC)
  • Loading branch information...
commit 06e7fec55af378e250883d40dcd62b641cc0ea4d 1 parent 6822dfa
@kares kares authored
View
8 activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -1,6 +1,6 @@
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLAdapter < AbstractAdapter
+ module PostgreSQL
class SchemaCreation < AbstractAdapter::SchemaCreation
private
@@ -33,10 +33,6 @@ def add_column_options!(sql, options)
end
end
- def schema_creation
- SchemaCreation.new self
- end
-
module SchemaStatements
# Drops the database specified on the +name+ attribute
# and creates it again using the provided +options+.
@@ -101,7 +97,7 @@ def tables(name = nil)
# If the schema is not specified as part of +name+ then it will only find tables within
# the current schema search path (regardless of permissions to access tables in other schemas)
def table_exists?(name)
- schema, table = Utils.extract_schema_and_table(name.to_s)
+ schema, table = PostgreSQLAdapter::Utils.extract_schema_and_table(name.to_s)
return false unless table
exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0
View
7 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -5,7 +5,6 @@
require 'active_record/connection_adapters/postgresql/oid'
require 'active_record/connection_adapters/postgresql/quoting'
require 'active_record/connection_adapters/postgresql/referential_integrity'
-
require 'active_record/connection_adapters/postgresql/schema_statements'
require 'active_record/connection_adapters/postgresql/database_statements'
@@ -245,7 +244,7 @@ class Table < ActiveRecord::ConnectionAdapters::Table
include PostgreSQL::Quoting
include PostgreSQL::ReferentialIntegrity
- include SchemaStatements
+ include PostgreSQL::SchemaStatements
include DatabaseStatements
include Savepoints
@@ -254,6 +253,10 @@ def adapter_name
ADAPTER_NAME
end
+ def schema_creation
+ PostgreSQL::SchemaCreation.new self
+ end
+
# Adds `:array` option to the default set provided by the
# AbstractAdapter
def prepare_column_options(column, types)
Please sign in to comment.
Something went wrong with that request. Please try again.