diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-02-12 13:26:40 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-02-12 13:26:40 -0800 |
commit | f8c8ad56c8a1cb48c6535fd8e248dcb9049e0aa3 (patch) | |
tree | 682c8ee01a1e05bc80f334241f3ec34445cfc571 /activerecord/lib | |
parent | 1fc6876b57f2e1d31731e74eb4271b5655e746d2 (diff) | |
parent | c321b309a9a90bbfa0912832c11b3fef52e71840 (diff) | |
download | rails-f8c8ad56c8a1cb48c6535fd8e248dcb9049e0aa3.tar.gz rails-f8c8ad56c8a1cb48c6535fd8e248dcb9049e0aa3.tar.bz2 rails-f8c8ad56c8a1cb48c6535fd8e248dcb9049e0aa3.zip |
Merge pull request #9204 from ranjaykrishna/col-prob
schema dumper tests now conducted by ActiveRecord::Base.Connection
Diffstat (limited to 'activerecord/lib')
5 files changed, 16 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 26f601bf05..eecf4faa5d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -326,6 +326,10 @@ module ActiveRecord # override in derived class ActiveRecord::StatementInvalid.new(message) end + + def valid_types?(type) + true + end end end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index c3512adc5f..de5232f960 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -748,6 +748,9 @@ module ActiveRecord execute("SET #{encoding} #{variable_assignments}", :skip_logging) end + def valid_type?(type) + !native_database_types[type].nil? + end end end end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 0818760b11..271a6848ee 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -887,6 +887,10 @@ module ActiveRecord def table_definition TableDefinition.new(self) end + + def valid_type?(type) + !native_database_types[type].nil? + end end end end diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 7bead4bde9..b644e7bd60 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -603,6 +603,10 @@ module ActiveRecord end end + def valid_type?(type) + true + end + end end end diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index df090b972d..fa9de926c5 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -118,7 +118,7 @@ HEADER # then dump all non-primary key columns column_specs = columns.map do |column| - raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" if @types[column.type].nil? + raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type) next if column.name == pk @connection.column_spec(column, @types) end.compact |