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,534 +0,0 @@
|
|
1
|
-
Overview
|
2
|
-
--------
|
3
|
-
|
4
|
-
Sequel 2.12 is really just a stepping stone to Sequel 3.0, which will
|
5
|
-
be released next month. All major changes currently planned for 3.0
|
6
|
-
have been made in 2.12, but 2.12 contains many features that have
|
7
|
-
been deprecated and will be removed or moved into extensions or
|
8
|
-
plugins in 3.0.
|
9
|
-
|
10
|
-
Deprecation Logging
|
11
|
-
-------------------
|
12
|
-
|
13
|
-
If you use a deprecated method or feature, Sequel will by default
|
14
|
-
print a deprecation message and 10 lines of backtrace to standard
|
15
|
-
error to easily allow you to figure out which code needs to be
|
16
|
-
updated. You can change where the deprecation messages go and how
|
17
|
-
many lines of backtrace are given using the following:
|
18
|
-
|
19
|
-
# Log deprecation information to a file
|
20
|
-
Sequel::Deprecation.output = File.open('deprecated.txt', 'wb')
|
21
|
-
|
22
|
-
# Use 5 lines of backtrace when logging deprecation messages
|
23
|
-
Sequel::Deprecation.backtraces = 5
|
24
|
-
|
25
|
-
# Use all backtrace lines when logging deprecation messages
|
26
|
-
Sequel::Deprecation.backtraces = true
|
27
|
-
|
28
|
-
# Don't include backtraces in the deprecation logging
|
29
|
-
Sequel.Deprecation.backtraces = false
|
30
|
-
|
31
|
-
# Turn off all deprecation logging
|
32
|
-
Sequel::Deprecation.output = nil
|
33
|
-
|
34
|
-
Deprecated Features Moving to Extensions
|
35
|
-
----------------------------------------
|
36
|
-
|
37
|
-
* Migrations are being moved into sequel/extensions/migration. There
|
38
|
-
isn't any reason that they should be loaded in normal use since
|
39
|
-
they are used so rarely. The sequel command line tool uses this
|
40
|
-
extension to run the migrations.
|
41
|
-
|
42
|
-
* Adding the blank? method to all objects has been moved into
|
43
|
-
sequel/extensions/blank.
|
44
|
-
|
45
|
-
* Dataset#print and Sequel::PrettyTable have been moved into
|
46
|
-
sequel/extensions/pretty_table.
|
47
|
-
|
48
|
-
* Dataset#query and related methods have been moved into
|
49
|
-
sequel/extensions/query.
|
50
|
-
|
51
|
-
* Dataset#paginate and related methods have been moved into
|
52
|
-
sequel/extensions/pagination.
|
53
|
-
|
54
|
-
* String inflection methods (e.g. "people".singularize) have been
|
55
|
-
moved into sequel/extensions/inflector.
|
56
|
-
|
57
|
-
* String date/time conversion methods (e.g. '2000-01-01'.to_date)
|
58
|
-
have been moved into sequel/extensions/string_date_time.
|
59
|
-
|
60
|
-
Deprecated Model Features Moving to Plugins
|
61
|
-
-------------------------------------------
|
62
|
-
|
63
|
-
* Model validation class methods have been moved to a plugin. Sequel
|
64
|
-
users are encouraged to write their own validate instance method
|
65
|
-
instead. A new validation_helpers plugin has been added to make
|
66
|
-
this easier, it's explained in the New Features section. If you
|
67
|
-
want to continue using the validation class methods:
|
68
|
-
|
69
|
-
Sequel::Model.plugin :validation_class_methods
|
70
|
-
|
71
|
-
* Model hook class methods have been moved to a plugin. Sequel users
|
72
|
-
are encouraged to write their own hook instance methods, and call
|
73
|
-
super to get hooks specified in superclasses or plugins. If you
|
74
|
-
want to continue using the hook class methods:
|
75
|
-
|
76
|
-
Sequel::Model.plugin :hook_class_methods
|
77
|
-
|
78
|
-
* Model schema methods (e.g. Model.set_schema, Model.create_table,
|
79
|
-
Model.drop_table) have been moved to a plugin. The use of these
|
80
|
-
methods has been discouraged for a long time. If you want to use
|
81
|
-
them:
|
82
|
-
|
83
|
-
Sequel::Model.plugin :schema
|
84
|
-
|
85
|
-
* Model.set_sti_key has been moved to a plugin. So you should
|
86
|
-
change:
|
87
|
-
|
88
|
-
MyModel.set_sti_key :key_column
|
89
|
-
|
90
|
-
to:
|
91
|
-
|
92
|
-
MyModel.plugin :single_table_inheritance, :key_column
|
93
|
-
|
94
|
-
* Model.set_cache has been moved to a plugin. So you should change:
|
95
|
-
|
96
|
-
MyModel.set_cache cache_store, opts
|
97
|
-
|
98
|
-
to:
|
99
|
-
|
100
|
-
MyModel.plugin :caching, cache_store, opts
|
101
|
-
|
102
|
-
* Model.serialize has been moved to a plugin. So you should change:
|
103
|
-
|
104
|
-
MyModel.serialize :column, :format=>:yaml
|
105
|
-
|
106
|
-
to:
|
107
|
-
|
108
|
-
MyModel.plugin :serialization, :yaml, :column
|
109
|
-
|
110
|
-
Because the previous serialization support depended on dataset
|
111
|
-
transforms, the new serialization support is implemented
|
112
|
-
differently, and behavior may not be identical in all cases.
|
113
|
-
However, this should be a drop in replacement for most users.
|
114
|
-
|
115
|
-
Deprecated Features To Be Removed in Sequel 3.0
|
116
|
-
-----------------------------------------------
|
117
|
-
|
118
|
-
* Dataset#transform is deprecated without any replacement planned.
|
119
|
-
It was announced on the Sequel mailing list that transforms would
|
120
|
-
be removed unless someone said they needed them, and nobody said
|
121
|
-
that they did.
|
122
|
-
|
123
|
-
* Dataset#multi_insert and Dataset#import are no longer aliases
|
124
|
-
of each other. Dataset#multi_insert now takes an array of hashes,
|
125
|
-
and Dataset#import now takes an array of columns and an array
|
126
|
-
of arrays of values. Using multi_insert with import's API or
|
127
|
-
vice-versa is deprecated.
|
128
|
-
|
129
|
-
* Calling Dataset#[] with no arguments or an integer argument is
|
130
|
-
deprecated.
|
131
|
-
|
132
|
-
* Calling Dataset#map with both an argument and a block is
|
133
|
-
deprecated.
|
134
|
-
|
135
|
-
* Database#multi_threaded? and Database#logger are both deprecated.
|
136
|
-
|
137
|
-
* Calling Database#transaction with a symbol to specify which server
|
138
|
-
to use is deprecated. You should now call it with an option hash
|
139
|
-
with a :server key.
|
140
|
-
|
141
|
-
* Array#extract_options! and Object#is_one_of? are both deprecated.
|
142
|
-
|
143
|
-
* The metaprogramming methods taken from metaid are deprecated and
|
144
|
-
have been moved into Sequel::Metaprogramming. If you want them
|
145
|
-
available to specific objects/classes, just include or extend with
|
146
|
-
Sequel::Metaprogramming. If you want all objects to have access to
|
147
|
-
the metaprogramming methods, install metaid. Note that the
|
148
|
-
class_def method from metaid doesn't exist in
|
149
|
-
Sequel::Metaprogramming, since it really isn't different from
|
150
|
-
define_method (except it is public instead of private).
|
151
|
-
|
152
|
-
* Module#class_attr_overridable, #class_attr_reader, and
|
153
|
-
#metaalias are deprecated.
|
154
|
-
|
155
|
-
* Using Model#set or #update when the columns for the model are not
|
156
|
-
set and you provide a hash with symbol keys is deprecated.
|
157
|
-
Basically, you must have setter methods now for any columns used in
|
158
|
-
#set or #update.
|
159
|
-
|
160
|
-
* Model#set_with_params and #update_with_params are deprecated, use
|
161
|
-
#set and #update instead.
|
162
|
-
|
163
|
-
* Model#save! is deprecated, use #save(:validate=>false).
|
164
|
-
|
165
|
-
* Model.is and Model.is_a are deprecated, use Model.plugin.
|
166
|
-
|
167
|
-
* Model.str_columns, Model#str_columns, #set_values, and
|
168
|
-
#update_values are deprecated. You should use #set and
|
169
|
-
#update instead of #set_values and #update_values, though they
|
170
|
-
operate differently.
|
171
|
-
|
172
|
-
* Model.delete_all, Model.destroy_all, Model.size, and Model.uniq
|
173
|
-
are deprecated, use .delete, .destroy, .count, and .distinct.
|
174
|
-
|
175
|
-
* Model.belongs_to, Model.has_many, and Model.has_and_belongs_to_many
|
176
|
-
are deprecated, use .many_to_one, .one_to_many, and .many_to_many.
|
177
|
-
|
178
|
-
* Model#dataset is deprecated, use Model.dataset.
|
179
|
-
|
180
|
-
* SQL::CastMethods#cast_as is deprecated, use #cast.
|
181
|
-
|
182
|
-
* Calling Database#schema without a table argument is deprecated.
|
183
|
-
|
184
|
-
* Dataset#uniq is deprecated, use Dataset#distinct.
|
185
|
-
|
186
|
-
* Dataset#symbol_to_column_ref is deprecated, use #literal.
|
187
|
-
|
188
|
-
* Dataset#quote_column_ref is deprecated, use #quote_identifier.
|
189
|
-
|
190
|
-
* Dataset#size is deprecated, use #count.
|
191
|
-
|
192
|
-
* Passing options to Dataset#each, #all, #single_record,
|
193
|
-
#single_value, #sql, #select_sql, #update, #update_sql, #delete,
|
194
|
-
#delete_sql, and #exists is deprecated. Modify the options first
|
195
|
-
using clone or a related method, then call one of the above
|
196
|
-
methods.
|
197
|
-
|
198
|
-
* Dataset#create_view and #create_or_replace_view are deprecated,
|
199
|
-
use the database methods instead.
|
200
|
-
|
201
|
-
* Dataset.dataset_classes, #model_classes, #polymorphic_key, and
|
202
|
-
#set_model are deprecated.
|
203
|
-
|
204
|
-
* Database#>> is deprecated.
|
205
|
-
|
206
|
-
* String#to_blob and SQL::Blob#to_blob are deprecated, use
|
207
|
-
#to_sequel_blob.
|
208
|
-
|
209
|
-
* The use of Symbol#| to create array subscripts is deprecated,
|
210
|
-
use Symbol#sql_subscript.
|
211
|
-
|
212
|
-
* Symbol#to_column_ref is deprecated, use Dataset#literal.
|
213
|
-
|
214
|
-
* String#expr is deprecated, use String#lit.
|
215
|
-
|
216
|
-
* Array#to_sql, String#to_sql, and String#split_sql are deprecated.
|
217
|
-
|
218
|
-
* Passing an array to Database#<< is deprecated.
|
219
|
-
|
220
|
-
* Range#interval is deprecated.
|
221
|
-
|
222
|
-
* Enumerable#send_each is deprecated.
|
223
|
-
|
224
|
-
* When using ruby 1.8, Hash#key is deprecated.
|
225
|
-
|
226
|
-
* Sequel.open is deprecated, use Sequel.connect.
|
227
|
-
|
228
|
-
* Sequel.use_parse_tree and Sequel.use_parse_tree= are deprecated.
|
229
|
-
|
230
|
-
* All upcase_identifier methods and the :upcase_identifiers database
|
231
|
-
option are deprecated, use identifier_input_method = :upcase
|
232
|
-
instead.
|
233
|
-
|
234
|
-
* Using a virtual row block without an argument is deprecated, see
|
235
|
-
Sequel.virtual_row_instance_eval= under New Features.
|
236
|
-
|
237
|
-
* When using the JDBC adapter, Java::JavaSQL::Timestamp#usec is
|
238
|
-
deprecated. Sequel has returned Java::JavaSQL::Timestamp as
|
239
|
-
DateTime or Time for a few versions, so this shouldn't affect most
|
240
|
-
people.
|
241
|
-
|
242
|
-
* Sequel will no longer require bigdecimal/util, enumerator, or yaml
|
243
|
-
in 3.0. If you need them in your code, make sure you require
|
244
|
-
them yourself. Using features added by requiring these standard
|
245
|
-
libaries will not bring up a deprecation warning, for obvious
|
246
|
-
reasons.
|
247
|
-
|
248
|
-
* Sequel::Error::InvalidTransform, Sequel::Error::NoExistingFilter,
|
249
|
-
and Sequel::Error::InvalidStatement exceptions will be removed in
|
250
|
-
Sequel 3.0. You will not get a deprecation message if you reference
|
251
|
-
them in 2.12.
|
252
|
-
|
253
|
-
* Sequel::Model::Validation::Errors is deprecated, use
|
254
|
-
Sequel::Model::Errors instead. Referencing the old name will not
|
255
|
-
bring up a deprecation message.
|
256
|
-
|
257
|
-
New Features
|
258
|
-
------------
|
259
|
-
|
260
|
-
* Sequel.virtual_row_instance_eval= was added, which lets you give
|
261
|
-
Sequel 2.12 the behavior that will be the standard in 3.0.
|
262
|
-
It changes blocks passed to Dataset#filter, #select, or #order that
|
263
|
-
don't accept arguments (or accept any number of arguments) to
|
264
|
-
instance eval the block in the context of a new VirtualRow
|
265
|
-
instance instead of passing a new VirtualRow instance to the block.
|
266
|
-
It allows you to change code that looks like this:
|
267
|
-
|
268
|
-
dataset.filter{|o| (o.number > 10) & (o.name > 'M')}
|
269
|
-
|
270
|
-
to:
|
271
|
-
|
272
|
-
dataset.filter{(number > 10) & (name > 'M')}
|
273
|
-
|
274
|
-
When instance_eval is used, only local variables are available
|
275
|
-
to the block. Any calls to instance methods will be interpreted
|
276
|
-
as calling VirtualRow#method_missing, which generates identifiers
|
277
|
-
or functions. When virtual_row_instance_eval is enabled, the
|
278
|
-
following type of code will break:
|
279
|
-
|
280
|
-
# amount is a instance method
|
281
|
-
dataset.filter{:number + amount > 0}
|
282
|
-
|
283
|
-
Just like this example, the only type of code that should break is
|
284
|
-
when a virtual row block was used when it wasn't necessary (since
|
285
|
-
it doesn't use the VirtualRow argument).
|
286
|
-
|
287
|
-
When Sequel.virtual_row_instance_eval = false, using a virtual row
|
288
|
-
block that doesn't accept an argument will cause a deprecation
|
289
|
-
message.
|
290
|
-
|
291
|
-
Here's a regular expression that should catch most places where you
|
292
|
-
are using a virtual row block without an argument.
|
293
|
-
|
294
|
-
egrep -nr '[^A-Za-z0-9_](filter|select|select_more|order|order_more|get|where|having|from|first|and|or|exclude|find|subset|constraint|check)( *(\([^)]*\) *)?){*[^|]' *
|
295
|
-
|
296
|
-
An RDoc page explaining virtual row blocks was added as well.
|
297
|
-
|
298
|
-
* A validation_helpers model plugin was added that allows you to do
|
299
|
-
validations similar to the old class level validations inside
|
300
|
-
the Model#validate instance method. The API has changed, but it's
|
301
|
-
capable of most of the same validations. It doesn't handle
|
302
|
-
acceptance_of or confirmation_of validations, as those shouldn't be
|
303
|
-
handled in the model.
|
304
|
-
|
305
|
-
# Old class level validations
|
306
|
-
validates_format_of :col, :with=>/.../
|
307
|
-
validates_length_of :col, :maximum=>5
|
308
|
-
validates_length_of :col, :minimum=>3
|
309
|
-
validates_length_of :col, :is=>4
|
310
|
-
validates_length_of :col, :within=>3..5
|
311
|
-
validates_not_string :col
|
312
|
-
validates_numericality_of :col
|
313
|
-
validates_numericality_of :col, :only_integer=>true
|
314
|
-
validates_presence_of :col
|
315
|
-
validates_inclusion_of :col, :in=>[3, 4, 5]
|
316
|
-
validates_uniqueness_of :col, :col2
|
317
|
-
validates_uniqueness_of([:col, :col2])
|
318
|
-
|
319
|
-
# New instance level validations
|
320
|
-
def validate
|
321
|
-
validates_format /.../, :col
|
322
|
-
validates_max_length 5, :col
|
323
|
-
validates_min_length 3, :col
|
324
|
-
validates_exact_length 4, :col
|
325
|
-
validates_length_range 3..5, :col
|
326
|
-
validates_not_string :col
|
327
|
-
validates_numeric :col
|
328
|
-
validates_integer :col
|
329
|
-
validates_presence :col
|
330
|
-
validates_includes([3,4,5], :col)
|
331
|
-
validates_unique :col, :col2
|
332
|
-
validates_unique([:col, :col2])
|
333
|
-
end
|
334
|
-
|
335
|
-
Another change made is to specify the same type of validation on
|
336
|
-
multiple attributes, you must use an array:
|
337
|
-
|
338
|
-
# Old
|
339
|
-
validates_length_of :name, :password, :within=>3..5
|
340
|
-
|
341
|
-
# New
|
342
|
-
def validate
|
343
|
-
validates_length_range 3..5, [:name, :password]
|
344
|
-
end
|
345
|
-
|
346
|
-
The :message, :allow_blank, :allow_missing, and :allow_nil options
|
347
|
-
are still respected. The :tag option is not needed as instance level
|
348
|
-
validations work with code reloading without workarounds. The :if
|
349
|
-
option is also not needed for instance level validations:
|
350
|
-
|
351
|
-
# Old
|
352
|
-
validates_presence_of :name, :if=>:new?
|
353
|
-
validates_presence_of :pass, :if=>{flag > 3}
|
354
|
-
|
355
|
-
# New
|
356
|
-
def validate
|
357
|
-
validates_presence(:name) if new?
|
358
|
-
validates_presence(:pass) if flag > 3
|
359
|
-
end
|
360
|
-
|
361
|
-
The validates_each also doesn't have an equivalent instance method,
|
362
|
-
since it is much easier to just write your own validation:
|
363
|
-
|
364
|
-
# Old
|
365
|
-
validates_each(:date) do |o,a,v|
|
366
|
-
o.errors.add(a, '...') unless v > Date.today
|
367
|
-
end
|
368
|
-
|
369
|
-
# New
|
370
|
-
def validate
|
371
|
-
errors.add(:date, '...') unless date > Date.today
|
372
|
-
end
|
373
|
-
|
374
|
-
* MySQL adapter datasets now have on_duplicate_key_update and
|
375
|
-
insert_ignore methods which modify the SQL used to support
|
376
|
-
ON DUPLICATE KEY UPDATE and INSERT INGORE syntax in multi_insert
|
377
|
-
and import.
|
378
|
-
|
379
|
-
* If you use the MySQL native adapter, you can set:
|
380
|
-
|
381
|
-
Sequel::MySQL.convert_invalid_date_time = nil
|
382
|
-
|
383
|
-
to return dates like "0000-00-00" and times like "25:00:00" as
|
384
|
-
nil values instead of raising an error. You can also set it
|
385
|
-
to :string to return the values as strings.
|
386
|
-
|
387
|
-
* You can now use Sequel without modifying any core classes, by
|
388
|
-
defining a SEQUEL_NO_CORE_EXTENSIONS constant or environment
|
389
|
-
variable. In 2.12, this may still add some deprecated methods to
|
390
|
-
the core classes, but in 3.0 no methods will be added to the core
|
391
|
-
classes if you use this.
|
392
|
-
|
393
|
-
* You can now use Sequel::Model without the associations
|
394
|
-
implementation by defining a SEQUEL_NO_ASSOCIATIONS constant or
|
395
|
-
environment variable.
|
396
|
-
|
397
|
-
Other Improvements
|
398
|
-
------------------
|
399
|
-
|
400
|
-
* Model column accessors have been made faster and the overhead of
|
401
|
-
creating them has been reduced significantly.
|
402
|
-
|
403
|
-
* ~{:bool_col=>true} now generates an bool_col IS NOT TRUE filter
|
404
|
-
instead of bool_col != TRUE. This makes it return records with
|
405
|
-
NULL values. If you only want to have false records, you should
|
406
|
-
use {:bool_col=>false}. This works better with SQL's 3 valued
|
407
|
-
boolean logic.
|
408
|
-
|
409
|
-
It is slightly inconsistent with ~{:col=>1}, since that won't
|
410
|
-
return values where col is NULL, but it gives the user the ability
|
411
|
-
to create an IS [NOT] (TRUE|FALSE) filter, which Sequel previously
|
412
|
-
did not support.
|
413
|
-
|
414
|
-
If you really want the old behavior, you can change it to
|
415
|
-
~{true=>:bool_col}.
|
416
|
-
|
417
|
-
* Model.use_transactions was added for setting whether model objects
|
418
|
-
should use transactions when destroying or saving records. Like
|
419
|
-
most Sequel options, it's settable on a global, per model, and
|
420
|
-
per object basis:
|
421
|
-
|
422
|
-
Sequel::Model.use_transactions = false
|
423
|
-
MyModel.use_transactions = true
|
424
|
-
my_model.use_transactions = false
|
425
|
-
|
426
|
-
You can also turn it on or off for specific save calls:
|
427
|
-
|
428
|
-
my_model.save(:transaction=>true)
|
429
|
-
|
430
|
-
* The Oracle adapter now supports schema parsing.
|
431
|
-
|
432
|
-
* When using Model.db=, all current dataset options are copied to
|
433
|
-
a new dataset created with the new db.
|
434
|
-
|
435
|
-
* Model::Errors#count was refactored to improve performance.
|
436
|
-
|
437
|
-
* Most exception classes that were located under Sequel::Error are
|
438
|
-
now located directly under Sequel. The old names are not
|
439
|
-
deprecated (unless mentioned above), but their use is now
|
440
|
-
discouraged. The exceptions have the same name except that
|
441
|
-
Sequel::Error::PoolTimeoutError changed to Sequel::PoolTimeout.
|
442
|
-
|
443
|
-
* Dataset#where now always affects the WHERE clause. Before, it
|
444
|
-
was just an alias of filter, so it modified the HAVING clause
|
445
|
-
if the dataset already had a HAVING clause.
|
446
|
-
|
447
|
-
* The optimization of Model.[] introduced in 2.11.0 broke on
|
448
|
-
databases that didn't support LIMIT. The optimization now works
|
449
|
-
on those databases.
|
450
|
-
|
451
|
-
* All of the the RDoc documentation was reviewed and many updates
|
452
|
-
were made, resulting in significantly improved documentation
|
453
|
-
quality.
|
454
|
-
|
455
|
-
* Model.def_dataset_method now works when the model doesn't have an
|
456
|
-
associated dataset, as it will add the method to a dataset
|
457
|
-
given to set_dataset in the future.
|
458
|
-
|
459
|
-
* Database#get and #select now take a block that is passed to
|
460
|
-
the dataset they create.
|
461
|
-
|
462
|
-
* You can disable the use of INSERT RETURNING in the shared
|
463
|
-
PostgreSQL adapter using disable_insert_returning. This is mostly
|
464
|
-
useful if you are inserting a large number of records.
|
465
|
-
|
466
|
-
* A bug relating to aliasing columns in the JDBC adapter has been
|
467
|
-
fixed.
|
468
|
-
|
469
|
-
* Sequel can now create and drop schema-qualified views.
|
470
|
-
|
471
|
-
* Performance of Dataset#destroy for model datasets was improved.
|
472
|
-
|
473
|
-
* The specs now run on Rspec 1.2.
|
474
|
-
|
475
|
-
* Internal dependence on the methods that Sequel adds to core
|
476
|
-
classes has been eliminated, any internal use of methods that
|
477
|
-
Sequel adds to the core classes is now considered a bug.
|
478
|
-
|
479
|
-
* A possible bug where Database#rename_table would not remove a
|
480
|
-
cached schema entry has been fixed.
|
481
|
-
|
482
|
-
* The Oracle and MySQL adapters now raise an error as soon as you
|
483
|
-
call distinct on a dataset, instead of waiting until the SQL is
|
484
|
-
generated.
|
485
|
-
|
486
|
-
Backwards Compatibilty
|
487
|
-
----------------------
|
488
|
-
|
489
|
-
* Saving a newly inserted record in an after_create or after_save
|
490
|
-
hook is no longer broken. It broke in 2.10 as a side effect of
|
491
|
-
allowing the hook to check whether or not the record was a new
|
492
|
-
record. The code has been changed so that a @was_new instance
|
493
|
-
variable will be defined to true if the record was just created.
|
494
|
-
|
495
|
-
Similarly, instead of not modifying changed_columns until after
|
496
|
-
the after hooks run, a @columns_updated instance variable will
|
497
|
-
be available in the after hooks that is a hash of exactly what
|
498
|
-
attribute keys and values were used in the update.
|
499
|
-
|
500
|
-
These changes break compatibility with 2.11.0 and 2.10.0, but
|
501
|
-
restore compatibility with 2.9.0 and previous versions.
|
502
|
-
|
503
|
-
* PostgreSQL no longer uses savepoints for nested transactions by
|
504
|
-
default. If you want to use a savepoint, you have to pass the
|
505
|
-
:savepoint option to the transaction method. Using savepoints
|
506
|
-
by default broke expectations when a method raised Rollback to
|
507
|
-
rollback the transaction, and it only rolled back to the last
|
508
|
-
savepoint.
|
509
|
-
|
510
|
-
* The anonymous model classes created by Sequel::Model() are now
|
511
|
-
stored in Model::ANONYMOUS_MODEL_CLASSES instead of the @models
|
512
|
-
class instance variable of the main module.
|
513
|
-
|
514
|
-
* The mappings of adapter schemes to classes are now stored in
|
515
|
-
Sequel::ADAPTER_MAP instead of the Database @@adapters class
|
516
|
-
variable.
|
517
|
-
|
518
|
-
* Model instances no longer contain a reference to their class's
|
519
|
-
@db_schema.
|
520
|
-
|
521
|
-
* Database schema sql methods (e.g. alter_table_sql) are now private.
|
522
|
-
|
523
|
-
* Database#[] no longer accepts a block. It's not possible to call
|
524
|
-
it with a block in general usage, anyway.
|
525
|
-
|
526
|
-
* The Sequel::Schema::SQL module no longer exists, the methods it
|
527
|
-
included were placed directly in the Sequel::Database class.
|
528
|
-
|
529
|
-
* The Sequel::SQL::SpecificExpression class has been removed,
|
530
|
-
subclasses now inherit from Sequel::SQL::Expression.
|
531
|
-
|
532
|
-
* Sequel now requires its own files with an absolute path.
|
533
|
-
|
534
|
-
* The file hierarchy of the sequel library changed significantly.
|