diff options
author | kares <self@kares.org> | 2014-05-14 12:42:36 +0200 |
---|---|---|
committer | kares <self@kares.org> | 2014-05-14 12:42:36 +0200 |
commit | 06e7fec55af378e250883d40dcd62b641cc0ea4d (patch) | |
tree | 9f640b31b59f4e90897feb3323058993cb4c7fff /activerecord | |
parent | 6822dfad31786d6c297e749e422e66b195cc70d1 (diff) | |
download | rails-06e7fec55af378e250883d40dcd62b641cc0ea4d.tar.gz rails-06e7fec55af378e250883d40dcd62b641cc0ea4d.tar.bz2 rails-06e7fec55af378e250883d40dcd62b641cc0ea4d.zip |
PostgreSQL's SchemaStatements seems a could candidate for re-use (with AR-JDBC)
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 5bf4c7afd6..8f95b65507 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/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 @@ module ActiveRecord 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 @@ module ActiveRecord # 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 diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index bf76b5ace6..b2bd13b3a0 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -5,7 +5,6 @@ require 'active_record/connection_adapters/postgresql/column' 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 @@ module ActiveRecord include PostgreSQL::Quoting include PostgreSQL::ReferentialIntegrity - include SchemaStatements + include PostgreSQL::SchemaStatements include DatabaseStatements include Savepoints @@ -254,6 +253,10 @@ module ActiveRecord 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) |