mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Define enable_extension method to prevent undefined method error
When mixing postgresql and another adapter like sqlite3 (for dev and test respectively), the task `db:test:prepare` will fail due to the `enable_extension` method not being defined in the abstract adapter. This patch simply adds an empty definition to prevent it.
This commit is contained in:
parent
a929b4d4c5
commit
fb9806e5d2
3 changed files with 32 additions and 0 deletions
|
@ -293,6 +293,14 @@ module ActiveRecord
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is meant to be implemented by the adapters that support extensions
|
||||||
|
def disable_extension(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
# This is meant to be implemented by the adapters that support extensions
|
||||||
|
def enable_extension(name)
|
||||||
|
end
|
||||||
|
|
||||||
# A list of extensions, to be filled in by adapters that support them. At
|
# A list of extensions, to be filled in by adapters that support them. At
|
||||||
# the moment only postgresql does.
|
# the moment only postgresql does.
|
||||||
def extensions
|
def extensions
|
||||||
|
|
|
@ -108,6 +108,18 @@ module ActiveRecord
|
||||||
assert_equal 2, result.column_types['status'].type_cast(result.last['status'])
|
assert_equal 2, result.column_types['status'].type_cast(result.last['status'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_supports_extensions
|
||||||
|
assert_not @conn.supports_extensions?, 'does not support extensions'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_respond_to_enable_extension
|
||||||
|
assert @conn.respond_to?(:enable_extension)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_respond_to_disable_extension
|
||||||
|
assert @conn.respond_to?(:disable_extension)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def insert(ctx, data, table='ex')
|
def insert(ctx, data, table='ex')
|
||||||
binds = data.map { |name, value|
|
binds = data.map { |name, value|
|
||||||
|
|
|
@ -354,6 +354,18 @@ module ActiveRecord
|
||||||
assert_nil @conn.primary_key('failboat')
|
assert_nil @conn.primary_key('failboat')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_supports_extensions
|
||||||
|
assert_not @conn.supports_extensions?, 'does not support extensions'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_respond_to_enable_extension
|
||||||
|
assert @conn.respond_to?(:enable_extension)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_respond_to_disable_extension
|
||||||
|
assert @conn.respond_to?(:disable_extension)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def assert_logged logs
|
def assert_logged logs
|
||||||
|
|
Loading…
Reference in a new issue