- Dataset mutation is now deprecated. Users should switch to using the
non-mutating methods.
# Instead of:
dataset.where!(:foo)
# Switch to:
dataset = dataset.where(:foo)
- Support for the Cubrid, Firebird, Informix, and Progress databases has been
deprecated. Any users of this support should consider creating an external
adapter with the current code and maintaining such support themselves.
- The do (DataObjects), swift, and jdbc/as400 adapters have been deprecated.
Any users of these adapters should consider creating an external adapter
with the current code and maintaining the adapter themselves.
- Model transaction hooks (after_commit, after_rollback,
after_destroy_commit, after_destroy_rollback) are now deprecated. Users
should switch to calling the after_commit and after_rollback database
transaction hooks directly.
# Instead of:
def after_commit
super
do_something
end
# Switch to:
def after_save
super
db.after_commit{do_something}
end
- Passing a block to Database#from is now deprecated. For backwards
compatibility, this block affected the WHERE clause instead of the FROM
clause. In Sequel 5,
Database#from blocks will be treated like Dataset#from blocks, and will
affect the FROM clause. This behavior has been available for years by using
the from_block extension.
# Instead of:
DB.from(:foo){a > b}
# Switch to:
DB.from(:foo).where{a > b}
- Passing non-hash arguments and multiple arguments to the model association
methods is now deprecated. Switch to using a hash as an argument.
# Instead of:
model.association(true)
model.association(proc{|ds| ds.where(:foo)})
# Switch to:
model.association(:reload=>true)
model.association(:callback=>proc{|ds| ds.where(:foo)})
model.association{|ds| ds.where(:foo)}
- Passing procs as filter arguments is now deprecated. These should now be
passed as blocks instead of arguments.
# Instead of:
dataset.where(proc{foo > bar})
# Switch to:
dataset.where{foo > bar}
- Passing multiple arguments or an array as filter arguments when the
array/arguments does not represent a conditions specifier (array of two
element arrays, treated like a hash) is now deprecated. Switch to calling
the filter method separately with each argument or using Sequel.& to combine the
arguments:
# Instead of:
dataset.where(:foo, :bar)
dataset.where([:foo, :bar])
# Switch to:
dataset.where(:foo).where(:bar)
dataset.where(Sequel.&(:foo, :bar))
- Returning false from model before hooks to cancel an action is now
deprecated. Switch to calling cancel_action instead.
# Instead of:
def before_save
return false if something
super
end
# Switch to:
def before_save
cancel_action('something bad') if something
super
end
- Database#each_server has been deprecated. Switch to using Database#servers
and Database#with_server from server_block extension:
# Instead of:
DB.each_server{|db| db.run("foo")}
# Switch to:
DB.extension :server_block
DB.servers.each{|s| DB.with_server(s){DB.run("foo")}}
- Calling Database#add_servers and Database#remove_servers on a database that
does not use the :servers option is now deprecated. Currently, the calls to
add_servers and remove_servers are ignored for such databases, which can
hide errors.
- Sequel::Postgres::PG_NAMED_TYPES is now deprecated. Switch to calling
Database#add_named_conversion_proc instead.
# Instead of:
require 'sequel/adapters/utils/pg_types'
Sequel::Postgres::PG_NAMED_TYPES[:foo] = lambda{|v| v}
DB = Sequel.connect('postgres://...')
# Switch to:
DB = Sequel.connect('postgres://...')
DB.add_named_conversion_proc(:foo){|v| v}
- Modifying the identifier mangling settings for a Database or Dataset is now
deprecated unless the identifier_mangling extension is explicitly loaded
into the Database instance.
- The Sequel::Database.single_threaded accessor is now deprecated. Switch to
using Sequel.single_threaded= and Sequel.single_threaded?.
- Sequel::Database.identifier_input_method,
Sequel::Database.identifier_output_method, and
Sequel::Database.quote_identifier accessors are now deprecated. Switch to
modifying the setting for each Database instance.
- Sequel.identifier_input_method=, Sequel.identifier_output_method=, and
Sequel.quote_identifer= setter methods are now deprecated. Switch to
modifying the setting for each Database instance.
- Calling Dataset#delete/update/truncate on datasets with limits or offsets
is now deprecated, unless the database will respect the limit or offset.
Currently, only MySQL and Microsoft SQL Server have limited support for
such deletes and updates. You should either call unlimited or
skip_limit_check before calling delete/update/truncate.
- Deprecate having duplicate column names in subclass tables when using the
class_table_inheritance plugin. The documentation has warned against this
for a long time, but the code did not enforce it.
- When using the association_pks plugin setter methods without the :delay_pks
association option set, a warning is now issued. In Sequel 5, the default will be to
assume that the :delay_pks option is :always, and not to make modifications
until the object is saved. If you would like to keep the current behavior,
set the :delay_pks=>false association option.
The current :delay_pks=>true behavior will be removed in Sequel 5, with it being treated
like :delay_pks=>:always. If you are relying on the current behavior of
:delay_pks=>true (delay for new objects, immediate for existing
objects), you will need to update your code.
- Database#dup/clone are now deprecated. They have never been handled
correctly, since the default implementation from Kernel has been used.
- Model.dup/clone are now deprecated. They have never been handled correctly,
as the default implemenation from Kernel/Module has been used.
- Database#use on MySQL is now deprecated. Switch to creating a new Database
instance instead of modifying the database for an existing instance.
- Database#database_name on MySQL is now deprecated. Switch to asking the
database server which database you are connected to:
# Instead of:
DB.database_name
# Switch to:
DB.get{DATABASE{}}
- In the lazy_attributes, nested_attributes, composition, and serialization
plugins, the *_module accessors are now deprecated. These were
implementation details that should not have been exposed.
- The schema plugin is now deprecated. Switch to defining the schema before
creating the model class using the Database schema methods.
- The scissors plugin is deprecated. It existed for compatibility with Sequel 3, but it is dangerous as it
makes it easier to modify all rows when the intent was to modify a single
row.
- The prepared_statements_associations and prepared_statements_with_pk
plugins are now deprecated. These plugins generally make things slower.
- Dataset#unbind, Sequel::Unbinder, and Sequel::UnbindDuplicate are now
deprecated. This mostly existed to support the
prepared_statements_associations and prepared_statements_with_pk plugins.
- Sequel::Error::* exception
class aliases are now deprecated. Switch to using the exception classes in
the Sequel namespace.
- Sequel::BeforeHookFailed is now deprecated. Switch to using Sequel::HookFailed.
- Calling Sequel::Qualifier.new with 2 arguments is now deprecated. Users
should switch to calling it with a single argument (the table used for
qualifying unqualified identifiers).
- Treating unrecognized prepared statement types as :select is now
deprecated. Switch to using :select as the prepared statement type.
- The @was_new instance variable available in model after_save hooks is now
deprecated. There is no deprecation warning associated with this change.
# Instead of:
def after_save
super
if @was_new
do_something
else
do_something_else
end
end
# Switch to:
def after_create
super
do_something
end
def after_update
super
do_something_else
end
- The @columns_updated instance variable available in model after_save and
after_update hooks is deprecated. Switch to using the new columns_updated
plugin and calling the columns_updated method.
- The Sequel.cache_anonymous_models accessor has been deprecated. Switch to
using Sequel::Model.cache_anonymous_models.
- Sequel::Model::ANONYMOUS_MODEL_CLASSES and
Sequel::Model::ANONYMOUS_MODEL_CLASSES_MUTEX have been deprecated.
- Sequel::Database::ResetIdentifierMangling has been deprecated.