sequel 5.6.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +30 -5099
- data/Rakefile +1 -1
- data/doc/opening_databases.rdoc +0 -2
- data/doc/postgresql.rdoc +31 -0
- data/doc/querying.rdoc +2 -2
- data/doc/release_notes/5.7.0.txt +108 -0
- data/doc/testing.rdoc +1 -0
- data/lib/sequel/adapters/jdbc/derby.rb +1 -1
- data/lib/sequel/adapters/jdbc/oracle.rb +11 -0
- data/lib/sequel/adapters/postgres.rb +1 -0
- data/lib/sequel/adapters/shared/postgres.rb +117 -13
- data/lib/sequel/connection_pool/sharded_threaded.rb +7 -6
- data/lib/sequel/connection_pool/threaded.rb +6 -6
- data/lib/sequel/core.rb +20 -0
- data/lib/sequel/database/logging.rb +3 -2
- data/lib/sequel/database/schema_generator.rb +1 -2
- data/lib/sequel/dataset/actions.rb +15 -5
- data/lib/sequel/extensions/connection_expiration.rb +3 -3
- data/lib/sequel/extensions/connection_validator.rb +3 -3
- data/lib/sequel/extensions/integer64.rb +30 -0
- data/lib/sequel/extensions/migration.rb +2 -3
- data/lib/sequel/plugins/pg_array_associations.rb +5 -3
- data/lib/sequel/plugins/validate_associated.rb +18 -0
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mssql_spec.rb +6 -6
- data/spec/adapters/mysql_spec.rb +1 -1
- data/spec/adapters/oracle_spec.rb +15 -1
- data/spec/adapters/postgres_spec.rb +78 -1
- data/spec/adapters/spec_helper.rb +3 -1
- data/spec/bin_spec.rb +1 -0
- data/spec/core/dataset_spec.rb +10 -0
- data/spec/extensions/integer64_spec.rb +22 -0
- data/spec/extensions/pg_array_associations_spec.rb +14 -2
- data/spec/extensions/spec_helper.rb +1 -0
- data/spec/integration/associations_test.rb +4 -4
- data/spec/integration/dataset_test.rb +2 -0
- data/spec/integration/spec_helper.rb +5 -11
- data/spec/model/spec_helper.rb +1 -0
- metadata +35 -165
- data/doc/release_notes/1.0.txt +0 -38
- data/doc/release_notes/1.1.txt +0 -143
- data/doc/release_notes/1.3.txt +0 -101
- data/doc/release_notes/1.4.0.txt +0 -53
- data/doc/release_notes/1.5.0.txt +0 -155
- data/doc/release_notes/2.0.0.txt +0 -298
- data/doc/release_notes/2.1.0.txt +0 -271
- data/doc/release_notes/2.10.0.txt +0 -328
- data/doc/release_notes/2.11.0.txt +0 -215
- data/doc/release_notes/2.12.0.txt +0 -534
- data/doc/release_notes/2.2.0.txt +0 -253
- data/doc/release_notes/2.3.0.txt +0 -88
- data/doc/release_notes/2.4.0.txt +0 -106
- data/doc/release_notes/2.5.0.txt +0 -137
- data/doc/release_notes/2.6.0.txt +0 -157
- data/doc/release_notes/2.7.0.txt +0 -166
- data/doc/release_notes/2.8.0.txt +0 -171
- data/doc/release_notes/2.9.0.txt +0 -97
- data/doc/release_notes/3.0.0.txt +0 -221
- data/doc/release_notes/3.1.0.txt +0 -406
- data/doc/release_notes/3.10.0.txt +0 -286
- data/doc/release_notes/3.11.0.txt +0 -254
- data/doc/release_notes/3.12.0.txt +0 -304
- data/doc/release_notes/3.13.0.txt +0 -210
- data/doc/release_notes/3.14.0.txt +0 -118
- data/doc/release_notes/3.15.0.txt +0 -78
- data/doc/release_notes/3.16.0.txt +0 -45
- data/doc/release_notes/3.17.0.txt +0 -58
- data/doc/release_notes/3.18.0.txt +0 -120
- data/doc/release_notes/3.19.0.txt +0 -67
- data/doc/release_notes/3.2.0.txt +0 -268
- data/doc/release_notes/3.20.0.txt +0 -41
- data/doc/release_notes/3.21.0.txt +0 -87
- data/doc/release_notes/3.22.0.txt +0 -39
- data/doc/release_notes/3.23.0.txt +0 -172
- data/doc/release_notes/3.24.0.txt +0 -420
- data/doc/release_notes/3.25.0.txt +0 -88
- data/doc/release_notes/3.26.0.txt +0 -88
- data/doc/release_notes/3.27.0.txt +0 -82
- data/doc/release_notes/3.28.0.txt +0 -304
- data/doc/release_notes/3.29.0.txt +0 -459
- data/doc/release_notes/3.3.0.txt +0 -192
- data/doc/release_notes/3.30.0.txt +0 -135
- data/doc/release_notes/3.31.0.txt +0 -146
- data/doc/release_notes/3.32.0.txt +0 -202
- data/doc/release_notes/3.33.0.txt +0 -157
- data/doc/release_notes/3.34.0.txt +0 -671
- data/doc/release_notes/3.35.0.txt +0 -144
- data/doc/release_notes/3.36.0.txt +0 -245
- data/doc/release_notes/3.37.0.txt +0 -338
- data/doc/release_notes/3.38.0.txt +0 -234
- data/doc/release_notes/3.39.0.txt +0 -237
- data/doc/release_notes/3.4.0.txt +0 -325
- data/doc/release_notes/3.40.0.txt +0 -73
- data/doc/release_notes/3.41.0.txt +0 -155
- data/doc/release_notes/3.42.0.txt +0 -74
- data/doc/release_notes/3.43.0.txt +0 -105
- data/doc/release_notes/3.44.0.txt +0 -152
- data/doc/release_notes/3.45.0.txt +0 -179
- data/doc/release_notes/3.46.0.txt +0 -122
- data/doc/release_notes/3.47.0.txt +0 -270
- data/doc/release_notes/3.48.0.txt +0 -477
- data/doc/release_notes/3.5.0.txt +0 -510
- data/doc/release_notes/3.6.0.txt +0 -366
- data/doc/release_notes/3.7.0.txt +0 -179
- data/doc/release_notes/3.8.0.txt +0 -151
- data/doc/release_notes/3.9.0.txt +0 -233
@@ -1,122 +0,0 @@
|
|
1
|
-
= New Features
|
2
|
-
|
3
|
-
* Dataset#first! has been added. This is identical to #first,
|
4
|
-
except where #first would return nil due to no row matching,
|
5
|
-
#first! raises a Sequel::NoMatchingRow exception. The main
|
6
|
-
benefit here is that a standard exception class is now used,
|
7
|
-
so external libraries can deal with these exceptions appropriately
|
8
|
-
(such as web applications returning a 404 error).
|
9
|
-
|
10
|
-
* Dataset#with_pk! has been added to model datasets. Similar to
|
11
|
-
#first!, this raises a Sequel::NoMatchingRow exception instead of
|
12
|
-
returning nil if there is no matching row.
|
13
|
-
|
14
|
-
* A drop_foreign_key method has been added to the alter_table
|
15
|
-
generator:
|
16
|
-
|
17
|
-
alter_table(:tab){drop_foreign_key :col}
|
18
|
-
|
19
|
-
This relies on foreign_key_list working and including the name
|
20
|
-
of the foreign key. Previously, you'd have to drop the foreign key
|
21
|
-
constraint before dropping the column in some cases.
|
22
|
-
|
23
|
-
* Column constraints can now be named using :*_constraint_name
|
24
|
-
options:
|
25
|
-
|
26
|
-
create_table(:tab) do
|
27
|
-
primary_key :id, :primary_key_constraint_name=>:pk_name
|
28
|
-
foriegn_key :t_id, :t, :foreign_key_constraint_name=>:fk_name,
|
29
|
-
:unique=>true, :unique_constraint_name=>:uk_name
|
30
|
-
end
|
31
|
-
|
32
|
-
This makes it easier to name constraints, which has always been
|
33
|
-
recommended as it makes it easier to drop such constraints in the
|
34
|
-
future.
|
35
|
-
|
36
|
-
* On Microsoft SQL Server, Dataset#cross_apply and #outer_apply have
|
37
|
-
been added to use CROSS/OUTER APPLY. These are useful if you
|
38
|
-
want to join a table to the output of a function that takes the
|
39
|
-
table as an argument.
|
40
|
-
|
41
|
-
= Other Improvements
|
42
|
-
|
43
|
-
* The connection pools are now faster when using the
|
44
|
-
:connection_handling=>:queue option.
|
45
|
-
|
46
|
-
* External connection pool classes can now be loaded automatically by
|
47
|
-
the :pool_class option.
|
48
|
-
|
49
|
-
* Database#each_server now raises if not given a block. Previously,
|
50
|
-
it just leaked Database references.
|
51
|
-
|
52
|
-
* On Microsoft SQL Server, ] characters are now escaped correctly in
|
53
|
-
identifiers.
|
54
|
-
|
55
|
-
* On PostgreSQL, infinite dates are also handled when using
|
56
|
-
Database#convert_infinite_timestamps. Previously, infinite dates
|
57
|
-
were incorrectly converted to 0000-01-01.
|
58
|
-
|
59
|
-
* The associations, composition, serialization, and dirty plugins
|
60
|
-
now clear caches stored in the instance in some additional cases,
|
61
|
-
such as when saving model instances when the dataset supports
|
62
|
-
insert_select.
|
63
|
-
|
64
|
-
* Model#validates_type in the validation_helpers plugin now handles
|
65
|
-
false values correctly.
|
66
|
-
|
67
|
-
* The string_stripper plugin has been fixed to not change the result
|
68
|
-
of Model.set_dataset.
|
69
|
-
|
70
|
-
* You can now drop primary key constraints on H2, using:
|
71
|
-
|
72
|
-
alter_table(:tab){drop_constraint :foo, :type=>:primary_key}
|
73
|
-
|
74
|
-
* The jdbc/as400 adapter has been fixed, it was broken starting in
|
75
|
-
Sequel 3.44.0.
|
76
|
-
|
77
|
-
* A Security guide has been added explaining various security issues
|
78
|
-
to think about when using Sequel.
|
79
|
-
|
80
|
-
= Backwards Compatibility
|
81
|
-
|
82
|
-
* The change to make associations, composition, serialization, and
|
83
|
-
dirty now clear caches after saving when the dataset supports
|
84
|
-
insert_select can break code that expected the previous behavior.
|
85
|
-
For example:
|
86
|
-
|
87
|
-
artist = Artist[1]
|
88
|
-
artist.has_albums # => false
|
89
|
-
|
90
|
-
album = Album.new(:artist=>artist)
|
91
|
-
def album.after_create
|
92
|
-
super
|
93
|
-
artist.update(:has_albums=>true)
|
94
|
-
end
|
95
|
-
album.save
|
96
|
-
|
97
|
-
artist.has_albums # => false
|
98
|
-
|
99
|
-
Such code should either refresh the artist after saving the album,
|
100
|
-
or use album.artist.has_albums. You already had to do that if
|
101
|
-
the dataset did not support insert_select; the impetus for this
|
102
|
-
change was to make the behavior consistent.
|
103
|
-
|
104
|
-
* Decimal/numeric columns are now strictly typecast by default,
|
105
|
-
similar to integer and real/double precision columns. If you want
|
106
|
-
the previous loose typecasting to for decimal/numeric columns,
|
107
|
-
use the looser_typecasting extension.
|
108
|
-
|
109
|
-
* External adapters that called Database.set_adapter_scheme with a
|
110
|
-
string should change to using a symbol.
|
111
|
-
|
112
|
-
* Dataset#select_map, #select_order_map, and #get now raise an
|
113
|
-
exception if they are passed a plain string inside an array.
|
114
|
-
If you do want to use a plain string, you now need to alias it:
|
115
|
-
|
116
|
-
dataset.get([Sequel.as('string', :some_alias)])
|
117
|
-
|
118
|
-
= Sequel 4 Implementation Planning
|
119
|
-
|
120
|
-
* Sequel 4 implementation planning has begun. If you want to view
|
121
|
-
and/or provide feedback on the implementation plan, see
|
122
|
-
https://github.com/jeremyevans/sequel-4-plans
|
@@ -1,270 +0,0 @@
|
|
1
|
-
= New Plugins
|
2
|
-
|
3
|
-
* An auto_validations plugin has been added, which automatically
|
4
|
-
adds not null, type, and unique validations based on information
|
5
|
-
obtained from parsing the database schema. If you don't
|
6
|
-
require customization of the validation error message per
|
7
|
-
column, this can significantly DRY up validation code. Currently
|
8
|
-
this plugin requires the database support index parsing; that
|
9
|
-
restriction will be removed in Sequel 4.
|
10
|
-
|
11
|
-
* An input_transformer plugin has been added, for automatically
|
12
|
-
running a transformation proc on all model column setter
|
13
|
-
input before use. This is a generalization of the
|
14
|
-
string_stripper plugin, allowing arbitrary modifications
|
15
|
-
to the input.
|
16
|
-
|
17
|
-
* An error_splitter plugin has been added, for splitting validation
|
18
|
-
errors applying to multiple columns into a separate validation
|
19
|
-
error per column. This is useful if you want to to include such
|
20
|
-
errors when using Errors#on to get all errors on the column. In
|
21
|
-
general, only uniqueness errors apply to multiple columns, so
|
22
|
-
those are the only errors likely to be affected.
|
23
|
-
|
24
|
-
= Other New Features
|
25
|
-
|
26
|
-
* Database.extension has been added, allowing you to load an
|
27
|
-
extension into all future databases. This is similar to loading a
|
28
|
-
plugin into Sequel::Model itself. For example, if you want all
|
29
|
-
Database instances to use the query_literals extension, run the
|
30
|
-
following before creating your Database instances:
|
31
|
-
|
32
|
-
Sequel::Database.extension :query_literals
|
33
|
-
|
34
|
-
* Database.after_initialize has been added for running a hook
|
35
|
-
on all new databases created.
|
36
|
-
|
37
|
-
* Model.default_set_fields_options has been added, allowing you
|
38
|
-
to set the default options for the #set_fields and #update_fields
|
39
|
-
methods. This is useful if you want to make :missing=>:raise
|
40
|
-
or :missing=>:skip the default behavior.
|
41
|
-
|
42
|
-
* The :setter, :adder, :remover, and :clearer association options
|
43
|
-
have been added. These allow you to override the default
|
44
|
-
implementation used to modify the association. :setter affects
|
45
|
-
the *_to_one setter method, :adder the *_to_many add_* method,
|
46
|
-
:remover the *_to_many remove_* method, and :clearer the
|
47
|
-
*_to_many remove_all_* method.
|
48
|
-
|
49
|
-
Previously, you had to override a private method to get the same
|
50
|
-
behavior, this just offers a nicer API for that.
|
51
|
-
|
52
|
-
* A :keep_reference Database option has been added. When set to
|
53
|
-
false, a reference to the Database instance is not kept in
|
54
|
-
Sequel::DATABASES. This is designed for Database instances
|
55
|
-
created by libraries, so they don't accidentally get chosen as
|
56
|
-
the default Sequel::Model database.
|
57
|
-
|
58
|
-
* Model#modified! now accepts a column and marks that column
|
59
|
-
as changed. This is useful if you plan on mutating the column
|
60
|
-
value as opposed to reassigning it.
|
61
|
-
|
62
|
-
* Model#modified? now accepts a column and returns whether the
|
63
|
-
column has been changed.
|
64
|
-
|
65
|
-
* The migrators now support an :allow_missing_migration_files
|
66
|
-
option, which makes them silently ignore errors related to
|
67
|
-
missing migration files.
|
68
|
-
|
69
|
-
* validates_schema_types has been added to validation_helpers,
|
70
|
-
which validates that the column values are instances of the
|
71
|
-
expected ruby type for the given database schema type. This
|
72
|
-
is a more robust version of the validates_not_string
|
73
|
-
extension, and users of validates_not_string are encouraged
|
74
|
-
to switch soon, as validates_not_string is going away in
|
75
|
-
Sequel 4.
|
76
|
-
|
77
|
-
validates_schema_type has been added to validation_class_methods,
|
78
|
-
which preforms the same validation, but it requires the columns
|
79
|
-
be listed explicitly.
|
80
|
-
|
81
|
-
validates_type in validation_helpers has been expanded to
|
82
|
-
accept an array of allowable classes.
|
83
|
-
|
84
|
-
Related to this is the addition of Database#schema_type_class for
|
85
|
-
returning the type class(es) for the given schema type symbol.
|
86
|
-
|
87
|
-
* validates_not_null has been added to the validation_helpers
|
88
|
-
plugin. This is similar to the validates_presence validation,
|
89
|
-
but only checks for nil values, allowing empty/blank strings.
|
90
|
-
|
91
|
-
* In the caching plugin, when the :ignore_exceptions option is true,
|
92
|
-
exceptions raised when deleting an object from the cache are now
|
93
|
-
ignored correctly.
|
94
|
-
|
95
|
-
* On PostgreSQL, Sequel now supports a :search_path Database
|
96
|
-
option to automatically set the client connection search_path.
|
97
|
-
This allows you to control which schemas do no require
|
98
|
-
qualification, and in which order to check schemas when
|
99
|
-
referencing unqualified objects. If you were using the
|
100
|
-
default_schema setting, it is recommended that you switch
|
101
|
-
to using :search_path instead.
|
102
|
-
|
103
|
-
* The pg_array extension can now register array types on a
|
104
|
-
per-Database basis via Database#register_array_type. Previously,
|
105
|
-
only global registration of array types was allowed. Additionally,
|
106
|
-
when registering array types on a per-Database basis, the oids can
|
107
|
-
be looked up automatically, making it possible to register array
|
108
|
-
types with just a type name:
|
109
|
-
|
110
|
-
DB.register_array_type(:interval)
|
111
|
-
|
112
|
-
* The pg_array extension now automatically creates conversion
|
113
|
-
procs for array types of all named types used by the
|
114
|
-
database. This means that if you use the pg_array and
|
115
|
-
pg_hstore extensions, the hstore[] type is now handled
|
116
|
-
correctly.
|
117
|
-
|
118
|
-
* The postgres adapter now supports :use_iso_date_format and
|
119
|
-
:convert_infinite_timestamps Database options. Previously,
|
120
|
-
use_iso_date_format was only a global setting, and
|
121
|
-
convert_infinite_timestamps could only be set after
|
122
|
-
initialization.
|
123
|
-
|
124
|
-
* Database#supports_schema_parsing? has been added to check
|
125
|
-
if schema parsing via the Database#schema method is
|
126
|
-
supported.
|
127
|
-
|
128
|
-
= Other Improvements
|
129
|
-
|
130
|
-
* A race condition related to prepared_sql for newly prepared
|
131
|
-
statements has been fixed.
|
132
|
-
|
133
|
-
* Dataset#get now works correctly if given an array with multiple
|
134
|
-
columns if there were no returned rows.
|
135
|
-
|
136
|
-
* The plugins that ship with Sequel now handle frozen model instances
|
137
|
-
correctly.
|
138
|
-
|
139
|
-
* Freezing of model instances now works correctly for models without
|
140
|
-
primary keys.
|
141
|
-
|
142
|
-
* Database constraints added with the constraint_validations
|
143
|
-
plugin now handle NULL values correctly if the :allow_nil=>true
|
144
|
-
setting is used.
|
145
|
-
|
146
|
-
* The pagination, pretty_table, query, schema_caching,
|
147
|
-
schema_dumper, and select_remove extensions can now be
|
148
|
-
loaded by Database#extension. If you are loading them
|
149
|
-
globally via Sequel.extension, switch to using
|
150
|
-
Database#extension, since that will be required starting
|
151
|
-
in Sequel 4.
|
152
|
-
|
153
|
-
* The lazy_attributes plugin no longer uses the identity_map plugin
|
154
|
-
internally, and eager loading lazy attributes now works correctly
|
155
|
-
without an active identity map.
|
156
|
-
|
157
|
-
* The many_to_one_pk_lookup plugin now handles many more corner
|
158
|
-
cases, and should be safe to enable by default.
|
159
|
-
|
160
|
-
* The static_cache plugin now has optimized implementations of
|
161
|
-
Model.map, .to_hash, and .to_hash_groups which work without a
|
162
|
-
database query. Model.count without arguments has also been
|
163
|
-
optimized to not require a database query.
|
164
|
-
|
165
|
-
* Fetching new records has been made faster when using the
|
166
|
-
update_primary_key plugin, since it was changed to cache the primary
|
167
|
-
key values lazily.
|
168
|
-
|
169
|
-
* When using the update_primary_key plugin, if the primary key
|
170
|
-
changes, clear the associations cache of all non-many_to_one
|
171
|
-
associations (since those will likely be based on the primary
|
172
|
-
key).
|
173
|
-
|
174
|
-
* The pg_typecast_on_load plugin no longer errors if given a
|
175
|
-
column that doesn't have a matching oid conversion proc.
|
176
|
-
|
177
|
-
* Handling of domain types on PostgreSQL has been significantly
|
178
|
-
improved. Domain type columns now have correct model
|
179
|
-
typecasting, and the pg_row extension correctly sets up
|
180
|
-
conversion procs for domain types inside composite types.
|
181
|
-
|
182
|
-
* Postgres::HStoreOp#- now automatically casts string input to
|
183
|
-
text, so that PostgreSQL doesn't assume the string is an
|
184
|
-
hstore.
|
185
|
-
|
186
|
-
* Postgres::PGRangeOp#starts_before and #ends_after have been
|
187
|
-
renamed to #ends_before and #starts_after. The previous
|
188
|
-
names were misleading. The old names are still available
|
189
|
-
for backwards compatibility, but they will be removed in the
|
190
|
-
Sequel 4.
|
191
|
-
|
192
|
-
* The pg_row plugin now handles aliased tables correctly.
|
193
|
-
|
194
|
-
* Model#validate in the validation_class_methods plugin no
|
195
|
-
longer skips validate methods in superclasses or previously
|
196
|
-
loaded plugins.
|
197
|
-
|
198
|
-
* Loading the touch plugin into a model subclass after it has
|
199
|
-
been loaded into a model superclass no longer ignores
|
200
|
-
inherited touched associations.
|
201
|
-
|
202
|
-
* Sequel no longer resets the conversion procs for the
|
203
|
-
Database instance when using Databaset#extension to load a
|
204
|
-
pg_* extension that adds global conversion procs. Instead,
|
205
|
-
the global conversion procs are added to the instance-specific
|
206
|
-
conversion procs. The result of this is that manually added
|
207
|
-
conversion procs will not be lost if an extension is loaded
|
208
|
-
afterward.
|
209
|
-
|
210
|
-
* The jdbc adapter now references the driver class before loading
|
211
|
-
subadapter specific code, which can fix issues if the database
|
212
|
-
tries to connect on initialization (such as the jdbc/postgres
|
213
|
-
adapter if the pg_hstore extension is loaded previously).
|
214
|
-
|
215
|
-
* A guide describing Sequel's support for advanced PostgreSQL
|
216
|
-
features has been added.
|
217
|
-
|
218
|
-
= Backwards Compatibility
|
219
|
-
|
220
|
-
* If you have already used the constraint_validations plugin to
|
221
|
-
create validations with the :allow_nil=>true option, you should
|
222
|
-
drop and regenerate those constraints to ensure they handle NULL
|
223
|
-
values correctly.
|
224
|
-
|
225
|
-
* The change to make PostgreSQL automatically handle domain
|
226
|
-
types can break previous code that set up special conversions
|
227
|
-
and typecasts per domain type. In the schema parsing, if you
|
228
|
-
want to get the domain type information, it will be contained
|
229
|
-
in the :db_domain_type and :domain_oid schema entries.
|
230
|
-
|
231
|
-
* Sequel::Postgres.use_iso_date_format is now only defined if
|
232
|
-
you are using the postgres adapter. Previously, it could
|
233
|
-
be defined when using other adapters with a pg_* extension,
|
234
|
-
even though the setting had no effect in that case.
|
235
|
-
|
236
|
-
* The validation_class_methods plugin now copies validations into
|
237
|
-
the subclass upon inheritance, instead of recursing into the
|
238
|
-
superclass on validation. This makes it more similar to how
|
239
|
-
all the other Sequel plugins work. However, it also means that
|
240
|
-
if you add validations to a superclass after creating a
|
241
|
-
subclass, the subclass won't have those validations. Additionally
|
242
|
-
if you skip superclass validations in a child class after creating
|
243
|
-
a grandchild class, the grandchild class could still have the
|
244
|
-
parent class's validations.
|
245
|
-
|
246
|
-
* The validates_unique validation in validation_helpers no longer
|
247
|
-
attempts to do the uniqueness query if the underlying columns
|
248
|
-
have validation errors. The reasoning behind this is that if the
|
249
|
-
underlying columns are not valid, the uniqueness query can cause
|
250
|
-
a DatabaseError.
|
251
|
-
|
252
|
-
* If you were passing strings in hstore format to
|
253
|
-
Postgres::HStoreOp#-, you should manually cast them to hstore:
|
254
|
-
|
255
|
-
hstore_op - Sequel.cast('a=>b', :hstore)
|
256
|
-
|
257
|
-
* The default validation error message for validates_type has been
|
258
|
-
modified.
|
259
|
-
|
260
|
-
* Database#schema_column_type was made public accidently by an
|
261
|
-
adapter and a few extensions. That has been fixed, but if you
|
262
|
-
were calling it with an explicit receiver and it happened to
|
263
|
-
work by accident before, you'll need to update your code.
|
264
|
-
|
265
|
-
= Sequel 4 Implementation Planning
|
266
|
-
|
267
|
-
* Sequel 4 implementation work will begin shortly. All Sequel users
|
268
|
-
are encouraged to read about the proposed changes and provide
|
269
|
-
feedback on the implementation plan. For details, see
|
270
|
-
https://github.com/jeremyevans/sequel-4-plans.
|
@@ -1,477 +0,0 @@
|
|
1
|
-
= Deprecation Warnings
|
2
|
-
|
3
|
-
The main change in Sequel 3.48.0 is the deprecation of Sequel
|
4
|
-
features that will be modified, moved, or removed in Sequel 4.
|
5
|
-
For the reasoning behind these changes, please review the
|
6
|
-
commits logs at
|
7
|
-
https://github.com/jeremyevans/sequel-4-plans/commits/master
|
8
|
-
|
9
|
-
== Deprecation Logging
|
10
|
-
|
11
|
-
If you use a deprecated method or feature, Sequel will by default
|
12
|
-
print a deprecation message and 10 lines of backtrace to stderr
|
13
|
-
to easily allow you to figure out which code needs to be
|
14
|
-
updated. You can change where the deprecation messages go and how
|
15
|
-
many lines of backtrace are given using the following:
|
16
|
-
|
17
|
-
# Log deprecation information to a file
|
18
|
-
Sequel::Deprecation.output = File.open('deprecated.txt', 'wb')
|
19
|
-
|
20
|
-
# Turn off all deprecation logging
|
21
|
-
Sequel::Deprecation.output = nil
|
22
|
-
|
23
|
-
# Use 5 lines of backtrace when logging deprecation messages
|
24
|
-
Sequel::Deprecation.backtrace_filter = 5
|
25
|
-
|
26
|
-
# Use all backtrace lines when logging deprecation messages
|
27
|
-
Sequel::Deprecation.backtrace_filter = true
|
28
|
-
|
29
|
-
# Don't include backtraces in the deprecation logging
|
30
|
-
Sequel::Deprecation.backtrace_filter = false
|
31
|
-
|
32
|
-
# Select which backtrace lines to output
|
33
|
-
Sequel::Deprecation.backtrace_filter = \
|
34
|
-
lambda{|line, line_no| line_no < 3 || line =~ /my_app/}
|
35
|
-
|
36
|
-
== Major Change
|
37
|
-
|
38
|
-
* The core extensions will no longer be loaded by default. You will
|
39
|
-
have to use `Sequel.extension :core_extensions` to load the core
|
40
|
-
extensions.
|
41
|
-
|
42
|
-
* The Symbol#[] and Symbol#{<,>,<=,>=} methods will no longer be
|
43
|
-
provided by the core extensions on ruby 1.8. You will have to
|
44
|
-
use `Sequel.extension :ruby18_symbol_extensions` to use them.
|
45
|
-
|
46
|
-
== Core Behavior Changes
|
47
|
-
|
48
|
-
* Dataset#filter becomes an alias for #where, and #exclude
|
49
|
-
becomes an alias for #exclude_where. You will have to
|
50
|
-
use `DB.extension :filter_having` to get the previous behavior.
|
51
|
-
Dataset#and and #or will also only affect the WHERE clause.
|
52
|
-
|
53
|
-
* Dataset#and, #or, and #invert will not raise errors for no existing
|
54
|
-
filter.
|
55
|
-
|
56
|
-
* Dataset#select_more becomes an alias for #select_append.
|
57
|
-
|
58
|
-
* Dataset#select and #from will not longer consider a hash argument as
|
59
|
-
an alias specification. You will have to use
|
60
|
-
`DB.extension :hash_aliases` to get the previous behavior.
|
61
|
-
|
62
|
-
* Database#dataset and Dataset.new will not take an options hash.
|
63
|
-
|
64
|
-
* Database#transaction :disconnect=>:retry option will be removed.
|
65
|
-
|
66
|
-
* Calling Dataset#add_graph_aliases before #graph or #set_graph_aliases
|
67
|
-
will raise an Error.
|
68
|
-
|
69
|
-
* Datasets will have a frozen options hash by default.
|
70
|
-
|
71
|
-
* Dataset#set_overrides and #set_defaults will move to the
|
72
|
-
set_overrides extension.
|
73
|
-
|
74
|
-
* Sequel.empty_array_handle_nulls will be removed. To get the
|
75
|
-
empty_array_handle_nulls = false behavior, you will have to
|
76
|
-
use `DB.extension :empty_array_ignore_nulls`.
|
77
|
-
|
78
|
-
* The second argument to Dataset #union, #intersect, and #except must
|
79
|
-
be an options hash if it is given.
|
80
|
-
|
81
|
-
* The fourth argument to Dataset #join_table must be an options
|
82
|
-
hash if it is given.
|
83
|
-
|
84
|
-
* Using a mismatched number of placeholders and arguments in a
|
85
|
-
placeholder literal string will raise an error.
|
86
|
-
|
87
|
-
* Dataset#graph_each will move to the graph_each extension.
|
88
|
-
|
89
|
-
* Database#default_schema will be removed.
|
90
|
-
|
91
|
-
* Dataset#[]= will be moved to the sequel_3_dataset_methods
|
92
|
-
extension.
|
93
|
-
|
94
|
-
* Dataset#insert_multiple will be moved to the
|
95
|
-
sequel_3_dataset_methods extension.
|
96
|
-
|
97
|
-
* Dataset#set will be moved to the sequel_3_dataset_methods
|
98
|
-
extension.
|
99
|
-
|
100
|
-
* Dataset#to_csv will be moved to the sequel_3_dataset_methods
|
101
|
-
extension.
|
102
|
-
|
103
|
-
* Dataset#db= and #opts= setters will be moved to the
|
104
|
-
sequel_3_dataset_methods extension.
|
105
|
-
|
106
|
-
* Dataset#qualify_to and #qualify_to_first_source will be moved to
|
107
|
-
the sequel_3_dataset_methods extension.
|
108
|
-
|
109
|
-
* Remove default methods that raise Sequel::NotImplemented:
|
110
|
-
Database#connect, #execute, #foreign_key_list, #indexes, #tables,
|
111
|
-
and #views, and Dataset#fetch_rows.
|
112
|
-
|
113
|
-
* Sequel::SQL::Expression#to_s will be removed.
|
114
|
-
|
115
|
-
* All Dataset methods in Dataset::PUBLIC_APPEND_METHODS except for
|
116
|
-
#literal, #quote_identifier, and #quote_schema_table will be
|
117
|
-
removed.
|
118
|
-
|
119
|
-
* All Dataset methods in Dataset::PRIVATE_APPEND_METHODS will
|
120
|
-
be removed.
|
121
|
-
|
122
|
-
* Sequel k_require, ts_require, tsk_require, and
|
123
|
-
check_requiring_thread will be removed.
|
124
|
-
|
125
|
-
* Dataset.def_append_methods will be removed.
|
126
|
-
|
127
|
-
* Dataset#table_ref_append will be removed.
|
128
|
-
|
129
|
-
* Sequel.virtual_row_instance_eval accessor will be removed.
|
130
|
-
|
131
|
-
* Database#reset_schema_utility_dataset will be removed.
|
132
|
-
|
133
|
-
== Adapter Behavior Changes
|
134
|
-
|
135
|
-
* The Database#do method will be removed from the ado, db2, dbi,
|
136
|
-
informix, odbc, openbase, and oracle adapters.
|
137
|
-
|
138
|
-
* The jdbc adapter will raise an error when parsing the schema
|
139
|
-
for a table if it detects results for the same table name in
|
140
|
-
multiple schemas.
|
141
|
-
|
142
|
-
* The Database#query method will be removed from the informix
|
143
|
-
adapter.
|
144
|
-
|
145
|
-
* Dataset#lock on PostgreSQL will check the given lock mode.
|
146
|
-
|
147
|
-
* Sequel will check the client_min_messages setting before
|
148
|
-
use on PostgreSQL.
|
149
|
-
|
150
|
-
* Prepared statement placeholders on PostgreSQL will no longer
|
151
|
-
support implicit casting via :$x__type.
|
152
|
-
|
153
|
-
== Extension Behavior Changes
|
154
|
-
|
155
|
-
* The following extensions will no longer make global changes to
|
156
|
-
the Database and Dataset classes: null_dataset, pagination,
|
157
|
-
pretty_table, query, schema_caching, schema_dumper,
|
158
|
-
select_remove, and to_dot. These will be changed to
|
159
|
-
Database/Dataset specific extensions.
|
160
|
-
|
161
|
-
* The pg_auto_parameterize and pg_statement_cache extensions will
|
162
|
-
be removed.
|
163
|
-
|
164
|
-
* Sequel::Dataset.introspect_all_columns will be removed from the
|
165
|
-
columns_introspection extension.
|
166
|
-
|
167
|
-
* PGRangeOp#starts_before and #ends_after will be removed from the
|
168
|
-
pg_range_ops extension.
|
169
|
-
|
170
|
-
== Model Behavior Changes
|
171
|
-
|
172
|
-
* Model#initialize will accept only one argument.
|
173
|
-
|
174
|
-
* The after_initialize hook will be moved to a plugin.
|
175
|
-
|
176
|
-
* Move blacklist-based security methods (#set_except, #update_except,
|
177
|
-
.set_restricted_columns) to a plugin.
|
178
|
-
|
179
|
-
* The :eager_loader and :eager_grapher association option procs will
|
180
|
-
always be passed a hash.
|
181
|
-
|
182
|
-
* Model string column setters will consider array and hash input to
|
183
|
-
be invalid.
|
184
|
-
|
185
|
-
* Remove save taking multiple arguments for the columns to save.
|
186
|
-
Add Model#save :columns option for saving specific columns.
|
187
|
-
|
188
|
-
* Don't automatically choose a reciprocal association with a condition
|
189
|
-
or block.
|
190
|
-
|
191
|
-
* Don't automatically set up reciprocal associations if multiple ones
|
192
|
-
match.
|
193
|
-
|
194
|
-
* Model::Errors#[] will no longer modify the receiver. If you want
|
195
|
-
autovivification, use the active_model plugin.
|
196
|
-
|
197
|
-
* Model.set_primary_key will not longer accept composite keys as
|
198
|
-
multiple arguments.
|
199
|
-
|
200
|
-
* The correlated_subquery eager limit strategy will be removed.
|
201
|
-
|
202
|
-
* The following Model class dataset methods will be removed: print,
|
203
|
-
each_page, paginate, set, add_graph_aliases, insert_multiple, query,
|
204
|
-
set_overrides, set_defaults, to_csv.
|
205
|
-
|
206
|
-
* The Model.{destroy,delete,update} class dataset methods will be
|
207
|
-
moved to the scissors plugin.
|
208
|
-
|
209
|
-
* Model#pk_or_nil will be removed.
|
210
|
-
|
211
|
-
* Model#set_values will no longer be called directly by any Sequel
|
212
|
-
code, and overriding it is deprecated. It will be removed in Sequel
|
213
|
-
4.1.
|
214
|
-
|
215
|
-
* Model.cache_anonymous_models accessor will move to Sequel module.
|
216
|
-
|
217
|
-
* Model::InstanceMethods.class_attr_overridable and
|
218
|
-
.class_attr_reader will be removed.
|
219
|
-
|
220
|
-
* The :one_to_one option check for one_to_many associations will
|
221
|
-
be removed.
|
222
|
-
|
223
|
-
== Plugin Behavior Changes
|
224
|
-
|
225
|
-
* Public dataset methods will no longer have class methods
|
226
|
-
automatically added.
|
227
|
-
|
228
|
-
* The validates_not_string validation will be removed from the
|
229
|
-
validation_class_methods and validation_helpers plugin.
|
230
|
-
|
231
|
-
* In the json_serializer plugin, the to_json :root=>true option
|
232
|
-
means :root=>:collection instead of :root=>:both.
|
233
|
-
|
234
|
-
* In the json_serializer plugin, the to_json :naked option will
|
235
|
-
default to true, and there will not be way to add the JSON.create_id
|
236
|
-
automatically.
|
237
|
-
|
238
|
-
* In the json_serializer plugin, from_json will no longer automatically
|
239
|
-
delete the JSON.create_id key from the input hash.
|
240
|
-
|
241
|
-
* The #to_json and #to_xml :all_columns and :all_associations options
|
242
|
-
in the json_serializer and xml_serializer plugins will be removed.
|
243
|
-
|
244
|
-
* The Model.json_create method will be removed from the
|
245
|
-
json_serializer plugin.
|
246
|
-
|
247
|
-
* The validates_type validation will raise validation errors for nil
|
248
|
-
if :allow_nil=>true is not used.
|
249
|
-
|
250
|
-
* auto_validate_presence_columns will be removed from the
|
251
|
-
auto_validations plugin
|
252
|
-
|
253
|
-
* The identity_map plugin will be removed.
|
254
|
-
|
255
|
-
== Internal Changes
|
256
|
-
|
257
|
-
* The sequel_core.rb and sequel_model.rb files will be removed.
|
258
|
-
|
259
|
-
* Dataset#{quote_identifiers,identifier_output_method,
|
260
|
-
identifier_input_method} will assume Database implements the
|
261
|
-
methods.
|
262
|
-
|
263
|
-
= Forwards Compatibility
|
264
|
-
|
265
|
-
Not all changes planned in Sequel 4 have deprecation warnings.
|
266
|
-
The following changes will be made in Sequel 4 but do not have
|
267
|
-
deprecation warnings in 3.48.0:
|
268
|
-
|
269
|
-
* The threaded connection pools will default to
|
270
|
-
:connection_handling=>:queue. You can manually set
|
271
|
-
:connection_handling=>:stack to get the current behavior.
|
272
|
-
|
273
|
-
* Dataset#join_table will default to :qualify=>:deep. You can
|
274
|
-
manually set :qualify=>:symbol to get the current behavior. This
|
275
|
-
can be set at a global level by overriding
|
276
|
-
Dataset#default_join_table_qualification.
|
277
|
-
|
278
|
-
* Model.raise_on_typecast_failure will default to false. Set this to
|
279
|
-
true to get the current behavior of raising typecast errors in the
|
280
|
-
setter methods.
|
281
|
-
|
282
|
-
* Model#save will no longer call Model#_refresh or Model#set_values
|
283
|
-
internally after an insert. Manually refreshes will be treated
|
284
|
-
differently than after creation refreshes in Sequel 4.
|
285
|
-
|
286
|
-
* On SQLite, integer_booleans will be true by default. Set this to
|
287
|
-
false to get the current behavior of 't' for true and 'f' for false.
|
288
|
-
|
289
|
-
* On SQLite, use_timestamp_timezones will be false by default. Set
|
290
|
-
this to true to get the current behavior with timezone information
|
291
|
-
in timestamps.
|
292
|
-
|
293
|
-
* The default value for most option hash arguments will be an empty
|
294
|
-
frozen hash. If you are overriding methods and modifying option
|
295
|
-
hashes, fix your code.
|
296
|
-
|
297
|
-
* The defaults_setter plugin will work in a lazy manner instead of
|
298
|
-
an eager manner. If you must have the values hash contain defaults
|
299
|
-
for new objects (instead of just getting defaults from getter
|
300
|
-
methods), you'll need to fork the current plugin.
|
301
|
-
|
302
|
-
* Model#set_all will allow setting the primary key columns.
|
303
|
-
|
304
|
-
* The many_to_one_pk_lookup plugin will be integrated into the
|
305
|
-
default associations support.
|
306
|
-
|
307
|
-
* The association_autoreloading plugin will be integrated into the
|
308
|
-
default associations support.
|
309
|
-
|
310
|
-
* Plugins will extend the class with ClassMethods before including
|
311
|
-
InstanceMethods in the class.
|
312
|
-
|
313
|
-
* Dataset#get, #select_map, and #select_order_map will automatically
|
314
|
-
add aliases for unaliased expressions if given a single expression.
|
315
|
-
|
316
|
-
* Database#tables and #views on PostgreSQL will check against
|
317
|
-
the current schemas in the search path.
|
318
|
-
|
319
|
-
* Sequel::SQL::SQLArray alias for ValueList will be removed.
|
320
|
-
|
321
|
-
* Sequel::SQL::NoBooleanInputMethods will be removed.
|
322
|
-
|
323
|
-
* Sequel::NotImplemented will be removed.
|
324
|
-
|
325
|
-
* Sequel::Model::EMPTY_INSTANCE_VARIABLES will be removed.
|
326
|
-
|
327
|
-
* Sequel will no longer provide a default database for the adapter or
|
328
|
-
integration specs.
|
329
|
-
|
330
|
-
= New Features
|
331
|
-
|
332
|
-
* You can now choose which Errors class to use on a per model basis
|
333
|
-
by overriding Model#errors_class.
|
334
|
-
|
335
|
-
* The following Database methods have been added to check for support:
|
336
|
-
supports_index_parsing?, supports_foreign_key_parsing?,
|
337
|
-
support_table_listing?, supports_view_listing?.
|
338
|
-
|
339
|
-
* The pg_hstore_ops extension now integrates with the pg_array,
|
340
|
-
pg_hstore, and pg_array_ops extensions, allowing you to pass in
|
341
|
-
arrays and hashes to be treated as PGArrays and HStores, and
|
342
|
-
returning ArrayOps for PostgreSQL functions/operators that
|
343
|
-
return arrays.
|
344
|
-
|
345
|
-
* Sequel.object_to_json and Sequel.json_parser_error_class
|
346
|
-
have been added and all internal json usage uses them, so you
|
347
|
-
can now override these methods if you want to use an alternative
|
348
|
-
json library with Sequel.
|
349
|
-
|
350
|
-
* The association_proxies plugin now accepts a block allowing the
|
351
|
-
user control over which methods are proxied to the dataset or
|
352
|
-
the cached array of instances. You can base the decision on
|
353
|
-
where to send the method using a variety of factors including
|
354
|
-
the method name, the method arguments, the state of the current
|
355
|
-
instance, or the related association. Here's an example of a
|
356
|
-
simple case just depending on the name of the method;
|
357
|
-
|
358
|
-
Model.plugin :association_proxies do |opts|
|
359
|
-
[:find, :where, :create].include?(opts[:method])
|
360
|
-
end
|
361
|
-
|
362
|
-
If the block returns true, the method is sent to the dataset,
|
363
|
-
otherwise it is sent to the array of associated objects.
|
364
|
-
|
365
|
-
* The auto_validations plugin now accepts a :not_null=>:presence
|
366
|
-
option, for doing a presence validation instead of a not_null
|
367
|
-
validation. This is useful for databases with NOT NULL
|
368
|
-
constraints where you also want to disallow empty strings.
|
369
|
-
|
370
|
-
* The auto_validations plugin now validates against explicit nil
|
371
|
-
values in NOT NULL columns that have defaults.
|
372
|
-
|
373
|
-
* The constraint_validations plugin now reflects validations, using
|
374
|
-
Model.constraint_validation_reflections.
|
375
|
-
|
376
|
-
Model.constraint_validation_reflections[:column]
|
377
|
-
# => [[:presence, {}],
|
378
|
-
# [:max_length, {:argument=>255, :message=>'just too long'}]]
|
379
|
-
|
380
|
-
* The constraint_validations plugin can now be set to pass specific
|
381
|
-
validations options to the validation_helpers plugin. This can be
|
382
|
-
useful if using the auto_validations plugin with this plugin to
|
383
|
-
avoid duplicate error messages for nil values:
|
384
|
-
|
385
|
-
Model.plugin :constraint_validations,
|
386
|
-
:validates_options=>{:presence=>{:allow_nil=>true}}
|
387
|
-
|
388
|
-
* The named_timezones extension can now be loaded as a database
|
389
|
-
extension, which allows for automatic conversions of string
|
390
|
-
timezones:
|
391
|
-
|
392
|
-
DB.extension :named_timezones
|
393
|
-
DB.timezone = 'America/Los_Angeles'
|
394
|
-
|
395
|
-
* Offsets are now emulated by Microsoft Access using a combination
|
396
|
-
of reverse orders and total counts. This is slow, especially on
|
397
|
-
large datasets, but probably better than having no support at all.
|
398
|
-
It is also possible to use the same code to support Microsoft
|
399
|
-
SQL Server 2000, but as Sequel does not support that (minimum
|
400
|
-
supported version is 2005), you have to do it manually:
|
401
|
-
|
402
|
-
Sequel.require 'adapters/utils/emulate_offset_with_reverse_and_count'
|
403
|
-
DB.extend_datasets Sequel::EmulateOffsetWithReverseAndCount
|
404
|
-
|
405
|
-
= Other Improvements
|
406
|
-
|
407
|
-
* Dataset#clone is now faster.
|
408
|
-
|
409
|
-
* Database methods that create datasets (fetch, from, select, get)
|
410
|
-
are now faster.
|
411
|
-
|
412
|
-
* Model.with_pk and .with_pk! are now faster.
|
413
|
-
|
414
|
-
* Dataset#or now just clones if given an empty argument, similar
|
415
|
-
to Dataset#where.
|
416
|
-
|
417
|
-
* Sequel now correctly frees statements after using them in the
|
418
|
-
ibmdb adapter. Previously, they weren't freed until GC, which
|
419
|
-
could result in errors if all available handles are in use.
|
420
|
-
|
421
|
-
* Dataset creation is now faster on Microsoft SQL Server.
|
422
|
-
|
423
|
-
* The mediumint and mediumtext types are now recognized on MySQL.
|
424
|
-
|
425
|
-
* The ado adapter now handles disconnecting an already disconnected
|
426
|
-
connection.
|
427
|
-
|
428
|
-
* The auto_validations plugin now works on databases that don't
|
429
|
-
support index parsing. However, it will not set up automatic
|
430
|
-
uniqueness validations on such databases.
|
431
|
-
|
432
|
-
* The validation_helpers is more strict in some cases when checking
|
433
|
-
for nil values, using a specific nil check instead of general
|
434
|
-
falsely check.
|
435
|
-
|
436
|
-
* The table inheritance plugins now correctly handle usage of
|
437
|
-
set_dataset in a subclass.
|
438
|
-
|
439
|
-
* The bin/sequel command line tool now has specs.
|
440
|
-
|
441
|
-
= Backwards Compatibility
|
442
|
-
|
443
|
-
* Sequel now uses aliases for many internal Dataset#get calls, such
|
444
|
-
as those used by table_exists? and max.
|
445
|
-
|
446
|
-
* Sequel now no longer uses class variables internally. Instead,
|
447
|
-
instance variables of the Sequel::Database class are used.
|
448
|
-
|
449
|
-
* Sequel now sets up the identifier mangling methods on Database
|
450
|
-
initialization instead of on first use.
|
451
|
-
|
452
|
-
* The private Database#adapter_initialize method has been added for
|
453
|
-
per adapter configuration. All internal adapters have been switched
|
454
|
-
to use this method instead of overridding initialize, and all
|
455
|
-
external adapters should as well. This makes sure that Database
|
456
|
-
instances are not added to Sequel::DATABASES until they have been
|
457
|
-
completely initialized.
|
458
|
-
|
459
|
-
* Virtual row blocks no longer convert their return values to an array.
|
460
|
-
Among other things, this means that having a virtual row block return
|
461
|
-
a hash works as expected.
|
462
|
-
|
463
|
-
* The private Dataset#hash_key_symbol method now only takes a single
|
464
|
-
argument.
|
465
|
-
|
466
|
-
* Database#constraint_validations in the constraint_validations plugin
|
467
|
-
now returns raw hash rows, instead of arrays of validation method
|
468
|
-
call arguments.
|
469
|
-
|
470
|
-
* Dataset#count now uses a lowercase count function in the SQL.
|
471
|
-
|
472
|
-
* Passing a non-String or Hash as the first argument to an adapter
|
473
|
-
method (e.g. Sequel.postgres(1)) now raises an error. Before, this used
|
474
|
-
to work on some adapters that implicitly converted the database
|
475
|
-
name to a string.
|
476
|
-
|
477
|
-
* The stats and dcov rake tasks were removed.
|