1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
|
= Deprecated Features
* The identifier_columns plugin is now deprecated. There is no reason
to use it when Sequel.split_symbols = false, which will be the
default in Sequel 5.
* The filter_having, hash_aliases, and sequel_3_dataset_methods
extensions are now deprecated. They only existed for backwards
compatibility with Sequel 3.
* The query_literals extension is now deprecated. It changes behavior
in a way that makes SQL injections more likely.
* The meta_def extension is now deprecated. It is no longer necessary,
since on ruby 1.9+ you can use define_singleton_method.
* The empty_array_ignore_nulls extension has been deprecated. It
has been a no-op since Sequel 4.25.0.
* The cti_base_model, cti_key, and cti_model_map class methods in
the class_table_inheritance plugin are now deprecated. Use
cti_models.first instead of cti_base_model, sti_key
instead of cti_key, and sti_model_map instead of cti_model_map.
* The :strict option in the nested_attributes plugin is now deprecated.
Switch to using the :unmatched_pk option.
* Database#reset_conversion_procs on PostgreSQL is now deprecated.
There will be no need to call it in Sequel 5.
* Using global conversion procs added by the pg_* extensions, without
loading the pg_* extension into the Database instance, are now
deprecated. Additionally, using PGArray.register or PGRange.register
to register global types is now also deprecated. Use
Database#register_array_type or Database#register_range_type instead
to register the types on a per-Database basis.
* Treating :natural_inner join type as NATURAL LEFT JOIN on MySQL is
now deprecated. MySQL doesn't support NATURAL INNER JOIN, but if
you were going to convert it, NATURAL JOIN would make more sense.
* Unexpected values passed to Dataset#insert_conflict on SQLite are
now deprecated. Only values that result in one of the following
strings will be allowed in Sequel 5: ROLLBACK, ABORT, FAIL, IGNORE,
and REPLACE.
* The Dataset#and, #exclude_where, #interval, and #range methods
are now deprecated. Undeprecated copies are now available in the
new sequel_4_dataset_methods extension.
* Model.<< is now deprecated. Intuitivately, you would except this
to call Model.create and return the Model class, but it calls <<
on the model's dataset and returns the dataset.
* The Sequel::Postgres::PG_TYPES constant is now deprecated. All
conversion procs should now be added on a per-Database basis using
add_conversion_proc or add_named_conversion_proc. The following
private Database methods related to conversion procs are now
deprecated, though some are still called internally and therefore
do not have deprecation warnings:
* add_named_conversion_procs
* conversion_procs_updated
* convert_named_procs_to_procs
* copy_conversion_procs
* get_conversion_procs
Related to this, loading the sequel/adapters/utils/pg_types.rb file
is now deprecated.
* The following adapter or database specific global accessors for setting
defaults are now deprecated:
* Sequel::DB2.use_clob_as_blob
* Sequel::IBMDB.convert_smallint_to_bool
* Sequel::MySQL.convert_invalid_date_time
* Sequel::MySQL.convert_tinyint_to_bool
* Sequel::MySQL.default_charset
* Sequel::MySQL.default_collate
* Sequel::MySQL.default_engine
* Sequel::Postgres.use_iso_date_format
* Sequel::Postgres.client_min_messages
* Sequel::Postgres.force_standard_strings
* Sequel::SqlAnywhere.convert_smallint_to_bool
Use the Database instance accessors or Database options instead to
change behavior.
* The following adapter or database specific dataset mutation methods are
now deprecated:
* convert_smallint_to_bool= (ibmdb adapter, SQLAnywhere)
* convert_types= (jdbc adapter)
* mssql_unicode_strings= (Microsoft SQL Server)
Use the with_* methods which return a modified copy of the dataset
instead of these mutation methods.
* The Dataset#non_sql_options private method is now deprecated.
External adapters that overrode this method should switch to
overriding Dataset#non_sql_option?.
* The Database#timestamp_convertor private method in the jdbc adapter
is now deprecated. Users should switch to method(:timestamp_convert).
* Modification of the Sequel::JDBC::TypeConvertor class is now
deprecated. External jdbc subadapters that were using this to add
custom conversion procs should be modified.
* Having the pg_row extension respect conversion procs for subtypes
added after the registeration of the composite type is now deprecated.
Now, all subtypes should have the appropriate conversion proc added
before the composite type is registered.
* Array#sql_array in the core_extensions extension is now deprecated.
Switch to using Array#sql_value_list.
* The SEQUEL_POSTGRES_USES_PG constant added by the postgres adapter
is now deprecated. Sequel::Postgres::USES_PG should be used instead.
* Many more internal Sequel constants have been deprecated.
= New Features
* The Model#to_json and Dataset#to_json methods in the json_serializer
plugin now support a block. This block is called with the
hash/array that would have be serialized to JSON, and the block
should return the object to serialize. This makes it easy to
customize the JSON output by adding new entries, or wrapping the
object in other object.
The Dataset#to_json method supports an :instance_block option, which
should be a proc that will be passed to Model#to_json.
In order to implement this, Sequel.object_to_json now passes any
block given to the to_json call on the object. If you are
overriding Sequel.object_to_json, you are responsible for making
sure the block is passed appropriately.
* The association_pks plugin now supports a
:association_pks_use_associated_table association option for
many_to_many associations. If this option is used, instead of just
looking at the join table, the association_pks getter will get the
primary keys from the associated table. This can be useful if the
association's right_primary_key does not match the associated
model's primary key, and you are interested in the primary keys of
the associated objects. If this option is used, no association_pks
setter method is created.
* Dataset#as_hash has been added as a replacement to #to_hash.
If you want, you can now undef_method :to_hash and use
as_hash and things will work. Doing so can work around
problems when using keyword argument splats in ruby 2.0+.
For example:
def foo(*a, **b)
end
foo(City.order(:id))
results in foo being called with a being [] and b being
City.order(:id).to_hash, which is unexpected and undesired
behavior. If you want to use keyword argument splats or other
places where ruby will call to_hash implicitly if it is defined,
using undef_method :to_hash is recommended.
* A Database#add_conversion_proc method has been added on
PostgreSQL. This method takes a type OID and either a block
or a callable argument to use as the conversion proc for the
type OID.
* The following adapter or database specific Database accessors
have been added for changing settings on a per-Database basis:
* convert_smallint_to_bool (ibmdb adapter)
* default_charset (MySQL)
* default_collate (MySQL)
* default_engine (MySQL)
* use_clob_as_blob (DB2)
* A Dataset#with_convert_types method has been added to the jdbc
adapter, for returning a modified dataset with the convert_types
setting changed.
= Other Improvements
* Using the postgres adapter with pg 0.21.0 no longer results in
deprecation warnings.
* When using the class_table_inheritance plugin and using a direct
subclass of the parent class that does not use a separate table,
as well as using the :alias option, the insert SQL used is now
correct. Previously, it attempted to insert into a subquery,
which is not valid SQL.
Additionally, the dataset for such a model no longer uses a
subquery, since there is no reason to do so as there is no join.
* Model.skip_auto_validations(:not_null) in the auto_validations
plugin now skips not null checks for columns with default
values, in addition to skipping not null checks for columns
without default values.
* The static_cache plugin now supports the options hash argument
to to_hash and to_hash_groups. Currently, it only supports
the :hash option, since the :all option doesn't make sense.
* When touching associations in the touch plugin, clear the
cached association, because otherwise the cached values will
be stale.
* The validation_class_methods plugin no longer requires the
blank extension.
* The validation_helpers plugin methods that support the
:allow_blank option now work correctly if the blank extension
is not loaded.
* Loading the column_conflicts plugin into a model a second time
no longer removes existing column conflict settings.
* On SQLite 3.8.8+, indexes automatically created from unique
constraints are now included in Database#indexes output.
* On SQLite 3.8.8+, partial indexes are now excluded from
Database#indexes output.
* Database#indexes on PostgreSQL 9.5+ now uses a simpler query
with the array_position function.
* Database#foreign_key_list on PostgreSQL now uses a single
query instead of two queries, and also uses the array_position
function on PostgreSQL 9.5+ to simplify the queries.
* On PostgreSQL and Derby, when calling Database#create_table
with the :ignore_index_errors option inside a transaction,
a savepoint is used around each index creation so that an
index error does not cause the entire transaction to fail.
A savepoint is also used on Microsoft SQL Server, but it
appears that Microsoft SQL Server rolls back the entire
transaction if CREATE INDEX returns an error, instead of
just rolling back to the savepoint.
* Encoding is now preserved when parsing PostgreSQL arrays in the
pg_array extension.
* Database#copy_table in the postgres adapter now does not
hide the underlying exception if an exception is raised
during processing.
* Database#copy_into in the jdbc/postgresql adapter now does not
hide the underlying exception if an exception is raised
during processing.
* Database#copy_into in the jdbc/postgresql adapter now
respects the :server option for using a specific shard.
* Calling #reset_conversion_procs on Database instance that
uses the pg_hstore extension now results in the hstore
type still being parsed. Previously, the hstore conversion
proc would be dropped.
* The postgres adapter no longer monkey-patches postgres-pr if it
uses that as the driver.
* Multiple thread-safety issues in the mock adapter have been
fixed.
* Thread safety issues when simultaneously loading multiple
adapters that access PostgreSQL have been fixed.
* Hash allocations have been reduced in the csv_serializer,
json_serializer, and xml_serializer plugins.
* The deprecated Sequel::Model::ANONYMOUS_MODEL_CLASSES
constant is now correctly populated with classes created
by Sequel::Model(). This was broken in starting in
Sequel 4.45.0.
= Backwards Compatibility
* The pg_array_associations plugin now loads the pg_array
extension into the Database instance if it is not already
loaded. This can break cases where the pg_array_associations
plugin is used on a non-PostgreSQL database.
* Support for using the old postgres driver has been removed
from the postgres adapter. The postgres adapter now only
supports pg and postgres-pr.
* When the postgres-pr driver is being used by the postgres
adapter, connecting to a database is only allowed if
standard strings are being forced (the default).
|