sequel 5.83.1 → 5.84.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sequel/adapters/shared/sqlite.rb +3 -1
  3. data/lib/sequel/database/schema_methods.rb +2 -0
  4. data/lib/sequel/extensions/pg_json_ops.rb +328 -1
  5. data/lib/sequel/sql.rb +8 -5
  6. data/lib/sequel/version.rb +2 -2
  7. metadata +2 -236
  8. data/CHANGELOG +0 -1397
  9. data/README.rdoc +0 -936
  10. data/doc/advanced_associations.rdoc +0 -884
  11. data/doc/association_basics.rdoc +0 -1859
  12. data/doc/bin_sequel.rdoc +0 -146
  13. data/doc/cheat_sheet.rdoc +0 -255
  14. data/doc/code_order.rdoc +0 -104
  15. data/doc/core_extensions.rdoc +0 -405
  16. data/doc/dataset_basics.rdoc +0 -96
  17. data/doc/dataset_filtering.rdoc +0 -222
  18. data/doc/extensions.rdoc +0 -77
  19. data/doc/fork_safety.rdoc +0 -84
  20. data/doc/mass_assignment.rdoc +0 -98
  21. data/doc/migration.rdoc +0 -660
  22. data/doc/model_dataset_method_design.rdoc +0 -129
  23. data/doc/model_hooks.rdoc +0 -254
  24. data/doc/model_plugins.rdoc +0 -270
  25. data/doc/mssql_stored_procedures.rdoc +0 -43
  26. data/doc/object_model.rdoc +0 -563
  27. data/doc/opening_databases.rdoc +0 -439
  28. data/doc/postgresql.rdoc +0 -611
  29. data/doc/prepared_statements.rdoc +0 -144
  30. data/doc/querying.rdoc +0 -1070
  31. data/doc/reflection.rdoc +0 -120
  32. data/doc/release_notes/5.0.0.txt +0 -159
  33. data/doc/release_notes/5.1.0.txt +0 -31
  34. data/doc/release_notes/5.10.0.txt +0 -84
  35. data/doc/release_notes/5.11.0.txt +0 -83
  36. data/doc/release_notes/5.12.0.txt +0 -141
  37. data/doc/release_notes/5.13.0.txt +0 -27
  38. data/doc/release_notes/5.14.0.txt +0 -63
  39. data/doc/release_notes/5.15.0.txt +0 -39
  40. data/doc/release_notes/5.16.0.txt +0 -110
  41. data/doc/release_notes/5.17.0.txt +0 -31
  42. data/doc/release_notes/5.18.0.txt +0 -69
  43. data/doc/release_notes/5.19.0.txt +0 -28
  44. data/doc/release_notes/5.2.0.txt +0 -33
  45. data/doc/release_notes/5.20.0.txt +0 -89
  46. data/doc/release_notes/5.21.0.txt +0 -87
  47. data/doc/release_notes/5.22.0.txt +0 -48
  48. data/doc/release_notes/5.23.0.txt +0 -56
  49. data/doc/release_notes/5.24.0.txt +0 -56
  50. data/doc/release_notes/5.25.0.txt +0 -32
  51. data/doc/release_notes/5.26.0.txt +0 -35
  52. data/doc/release_notes/5.27.0.txt +0 -21
  53. data/doc/release_notes/5.28.0.txt +0 -16
  54. data/doc/release_notes/5.29.0.txt +0 -22
  55. data/doc/release_notes/5.3.0.txt +0 -121
  56. data/doc/release_notes/5.30.0.txt +0 -20
  57. data/doc/release_notes/5.31.0.txt +0 -148
  58. data/doc/release_notes/5.32.0.txt +0 -46
  59. data/doc/release_notes/5.33.0.txt +0 -24
  60. data/doc/release_notes/5.34.0.txt +0 -40
  61. data/doc/release_notes/5.35.0.txt +0 -56
  62. data/doc/release_notes/5.36.0.txt +0 -60
  63. data/doc/release_notes/5.37.0.txt +0 -30
  64. data/doc/release_notes/5.38.0.txt +0 -28
  65. data/doc/release_notes/5.39.0.txt +0 -19
  66. data/doc/release_notes/5.4.0.txt +0 -80
  67. data/doc/release_notes/5.40.0.txt +0 -40
  68. data/doc/release_notes/5.41.0.txt +0 -25
  69. data/doc/release_notes/5.42.0.txt +0 -136
  70. data/doc/release_notes/5.43.0.txt +0 -98
  71. data/doc/release_notes/5.44.0.txt +0 -32
  72. data/doc/release_notes/5.45.0.txt +0 -34
  73. data/doc/release_notes/5.46.0.txt +0 -87
  74. data/doc/release_notes/5.47.0.txt +0 -59
  75. data/doc/release_notes/5.48.0.txt +0 -14
  76. data/doc/release_notes/5.49.0.txt +0 -59
  77. data/doc/release_notes/5.5.0.txt +0 -61
  78. data/doc/release_notes/5.50.0.txt +0 -78
  79. data/doc/release_notes/5.51.0.txt +0 -47
  80. data/doc/release_notes/5.52.0.txt +0 -87
  81. data/doc/release_notes/5.53.0.txt +0 -23
  82. data/doc/release_notes/5.54.0.txt +0 -27
  83. data/doc/release_notes/5.55.0.txt +0 -21
  84. data/doc/release_notes/5.56.0.txt +0 -51
  85. data/doc/release_notes/5.57.0.txt +0 -23
  86. data/doc/release_notes/5.58.0.txt +0 -31
  87. data/doc/release_notes/5.59.0.txt +0 -73
  88. data/doc/release_notes/5.6.0.txt +0 -31
  89. data/doc/release_notes/5.60.0.txt +0 -22
  90. data/doc/release_notes/5.61.0.txt +0 -43
  91. data/doc/release_notes/5.62.0.txt +0 -132
  92. data/doc/release_notes/5.63.0.txt +0 -33
  93. data/doc/release_notes/5.64.0.txt +0 -50
  94. data/doc/release_notes/5.65.0.txt +0 -21
  95. data/doc/release_notes/5.66.0.txt +0 -24
  96. data/doc/release_notes/5.67.0.txt +0 -32
  97. data/doc/release_notes/5.68.0.txt +0 -61
  98. data/doc/release_notes/5.69.0.txt +0 -26
  99. data/doc/release_notes/5.7.0.txt +0 -108
  100. data/doc/release_notes/5.70.0.txt +0 -35
  101. data/doc/release_notes/5.71.0.txt +0 -21
  102. data/doc/release_notes/5.72.0.txt +0 -33
  103. data/doc/release_notes/5.73.0.txt +0 -66
  104. data/doc/release_notes/5.74.0.txt +0 -45
  105. data/doc/release_notes/5.75.0.txt +0 -35
  106. data/doc/release_notes/5.76.0.txt +0 -86
  107. data/doc/release_notes/5.77.0.txt +0 -63
  108. data/doc/release_notes/5.78.0.txt +0 -67
  109. data/doc/release_notes/5.79.0.txt +0 -28
  110. data/doc/release_notes/5.8.0.txt +0 -170
  111. data/doc/release_notes/5.80.0.txt +0 -40
  112. data/doc/release_notes/5.81.0.txt +0 -31
  113. data/doc/release_notes/5.82.0.txt +0 -61
  114. data/doc/release_notes/5.83.0.txt +0 -56
  115. data/doc/release_notes/5.9.0.txt +0 -99
  116. data/doc/schema_modification.rdoc +0 -679
  117. data/doc/security.rdoc +0 -443
  118. data/doc/sharding.rdoc +0 -286
  119. data/doc/sql.rdoc +0 -648
  120. data/doc/testing.rdoc +0 -204
  121. data/doc/thread_safety.rdoc +0 -15
  122. data/doc/transactions.rdoc +0 -250
  123. data/doc/validations.rdoc +0 -558
  124. data/doc/virtual_rows.rdoc +0 -265
@@ -1,63 +0,0 @@
1
- = New Features
2
-
3
- * The :nulls option when creating ordered expressions is now supported
4
- on all databases that Sequel ships support for. For databases that
5
- do not support NULLS FIRST/NULLS LAST, support is emulated.
6
-
7
- ds.order(Sequel.asc(:name, :nulls=>:last))
8
- # When emulated:
9
- # ORDER BY (CASE WHEN (name IS NULL) THEN 2 ELSE 1 END), name ASC
10
-
11
- * Model#pk_equal? has been added as a more descriptive name for
12
- Model#===. Model#=== is now an alias of Model#pk_equal?.
13
-
14
- * The roots and roots_dataset class methods in the tree plugin are now
15
- also available as dataset methods.
16
-
17
- = Other Improvements
18
-
19
- * Inverting expressions using the ANY/SOME/ALL SQL operators now works
20
- correctly:
21
-
22
- # Sequel <5.14.0
23
- Sequel.~(:a=>Sequel.function(:any, :x))
24
- # "(a != any(x))"
25
-
26
- # Sequel >=5.14.0
27
- Sequel.~(:a=>Sequel.function(:any, :x))
28
- # "NOT (a = any(x))"
29
-
30
- Sequel has always tried to push inversion down to create SQL that is
31
- easier to reason about. However, inversion cannot be pushed down if
32
- an ANY/SOME/ALL SQL operator is used, because that is a different
33
- type of operation that just happens to use the same syntax. Sequel
34
- now avoids inversion push down for boolean operators where the
35
- right hand side is an SQL::Function, LiteralString, or
36
- SQL::PlaceholderLiteralString.
37
-
38
- * When creating a boolean expression from a hash or array of pairs, if
39
- the right hand side is an unfrozen array and string, use a frozen
40
- copy in the expression, so that mutating the array or string
41
- argument later does not affect the expression.
42
-
43
- * When using the defaults_setter plugin with the :cache option, do not
44
- cache values for columns without parseable defaults. If the default
45
- value exists but is not parseable, caching such values could result
46
- in incorrect behavior if the model instance is saved later.
47
-
48
- * For models with composite primary keys, Model#=== now returns false
49
- if any primary key value is nil, mirroring the behavior for the
50
- scalar primary key case.
51
-
52
- * Model datasets no longer cache SQL if they include a subquery that
53
- cannot cache SQL.
54
-
55
- * The SQL used for constraints in the constraint_validations
56
- extension when the :allow_nil option is used is now clearer and
57
- easier to understand.
58
-
59
- * The postgres adapter no longer specifies a default port when using
60
- the pg driver, in order to work with configurations where the
61
- :service option is used in the :driver_options hash. The pg driver
62
- defaults to port 5432 if no port is given, so this should not affect
63
- backwards compatibility.
@@ -1,39 +0,0 @@
1
- = New Features
2
-
3
- * A :qualify_tables option has been added to the
4
- class_table_inheritance plugin, which will automatically qualify
5
- subclass tables with the same qualifier as the superclass table
6
- if the superclass table is qualified.
7
-
8
- * Model#save_validation_on_next_save! has been added, which skips all
9
- validation on the next save to the object, including the running
10
- of validation related hooks. This method is designed for use only
11
- when Model#valid? is called on the object before saving, to avoid
12
- running validations on the object twice. This method takes
13
- precedence even over an explicit validate: true option passed to
14
- Model#save, and as such should be used with care.
15
-
16
- * The postgres adapter now supports a :conn_str Database option to
17
- use a PostgreSQL connection string (e.g. "host=foo port=2442") when
18
- connecting. This option has preference over other connection
19
- related options if it is present.
20
-
21
- = Other Improvements
22
-
23
- * If a foreign key for a model object is changed from a nil value to
24
- a non-nil value, any cached associated objects related to the
25
- foreign key are no longer removed. Such associated objects could
26
- only be set manually, and if they have been set manually, it is
27
- probably not a good idea to remove them automatically.
28
-
29
- * When using the nested_attributes plugin, new *_to_many associated
30
- objects are not validated twice when saving.
31
-
32
- * The default table alias when using the class_table_inheritance
33
- plugin now correctly handles qualified tables.
34
-
35
- * A theoretical thread safety issue when assigning connections
36
- in the threaded connection pools has been fixed.
37
-
38
- * Renaming columns is now supported without emulation when using
39
- SQLite 3.25+.
@@ -1,110 +0,0 @@
1
- = New Features
2
-
3
- * Database#rollback_on_exit has been added, which allows you to
4
- rollback transactions instead of committing them when exiting
5
- the transaction block. Previously, the only way to rollback
6
- a transaction from inside a transaction block was to raise
7
- an exception. This allows you to tell Sequel to roll the
8
- transaction back on exit, and then use return or throw to exit
9
- the transaction block.
10
-
11
- Database#rollback_on_exit supports savepoints, including
12
- multiple savepoint levels, as well as canceling rollbacks:
13
-
14
- DB.transaction do # BEGIN
15
- DB.rollback_on_exit
16
- end # ROLLBACK
17
-
18
- DB.transaction do # BEGIN
19
- DB.transaction(savepoint: true) do # SAVEPOINT
20
- DB.rollback_on_exit(savepoint: true)
21
- end # ROLLBACK TO SAVEPOINT
22
- end # COMMIT
23
-
24
- DB.transaction do # BEGIN
25
- DB.transaction(savepoint: true) do # SAVEPOINT
26
- DB.transaction(savepoint: true) do # SAVEPOINT
27
- DB.rollback_on_exit(savepoint: true)
28
- end # ROLLBACK TO SAVEPOINT
29
- end # RELEASE SAVEPOINT
30
- end # COMMIT
31
-
32
- DB.transaction do # BEGIN
33
- DB.transaction(savepoint: true) do # SAVEPOINT
34
- DB.rollback_on_exit(savepoint: true)
35
- end # ROLLBACK TO SAVEPOINT
36
- end # COMMIT
37
-
38
- DB.transaction do # BEGIN
39
- DB.transaction(savepoint: true) do # SAVEPOINT
40
- DB.transaction(savepoint: true) do # SAVEPOINT
41
- DB.rollback_on_exit(savepoint: 2)
42
- end # ROLLBACK TO SAVEPOINT
43
- end # ROLLBACK TO SAVEPOINT
44
- end # COMMIT
45
-
46
- DB.transaction do # BEGIN
47
- DB.transaction(savepoint: true) do # SAVEPOINT
48
- DB.transaction(savepoint: true) do # SAVEPOINT
49
- DB.rollback_on_exit(savepoint: 3)
50
- end # ROLLBACK TO SAVEPOINT
51
- end # ROLLBACK TO SAVEPOINT
52
- end # ROLLBACK
53
-
54
- DB.transaction do # BEGIN
55
- DB.rollback_on_exit
56
- DB.rollback_on_exit(cancel: true)
57
- end # COMMIT
58
-
59
- * Sequel now supports window functions on SQLite 3.26.0+. SQLite
60
- technically supports window functions on 3.25.0+, but enabling
61
- window function support in Sequel opens up a code path that
62
- generates queries that cause older versions of SQLite to produce a
63
- segmentation fault. This bug in SQLite has been fixed in 3.26.0.
64
-
65
- = Other Improvements
66
-
67
- * Sequel::Model no longer overrides existing methods when defining
68
- getters and setters. Historically, it only checked for existing
69
- method definitions for methods that could be directly expressed
70
- (e.g. not requiring send). Sequel 5 broke the check for setter
71
- methods that could be directly expressed. This fixes cases where
72
- model inheritance is used and the setter methods are overridden
73
- in a parent class.
74
-
75
- * Alter table emulation now works correctly on SQLite 3.26.0+.
76
-
77
- * The one_to_one association setter does not modify reciprocal
78
- associations in cases where doing so is not necessary. This can
79
- fix some cases where the nested_attributes plugin is used.
80
-
81
- * The class_table_inheritance plugin can now take advantage of the
82
- schema_caching extension to prevent database queries to determine
83
- column information when the class is created.
84
-
85
- * The nested_attributes plugin no longer validates one_to_one
86
- associations twice when saving.
87
-
88
- * The class_table_inheritance plugin :qualify_tables option now
89
- correctly qualifies subclasses of subclasses.
90
-
91
- * SQL expressions that are subscripted are now wrapped in parentheses.
92
- This fixes at least subscripting a function expression on
93
- PostgreSQL:
94
-
95
- DB[:t].select{array_agg(column).sql_subscript(1)}
96
- # SELECT (array_agg(column))[1] FROM t
97
-
98
- * Sequel::Migrator now uses more descriptive error messages if a
99
- missing or empty migration directory is given.
100
-
101
- * bin/sequel -C when converting from SQLite to another database
102
- type will now use 64-bit integer columns in the other database when
103
- the SQLite column type is integer, as SQLite supports storing
104
- 64-bit values in integer columns, and most other databases only
105
- support 32-bit values in integer columns.
106
-
107
- = Backwards Compatibility
108
-
109
- * The mysql adapter no longer attempts to load the mysqlplus driver,
110
- it now only attempts to load the mysql driver.
@@ -1,31 +0,0 @@
1
- = New Features
2
-
3
- * An instance-level skip_auto_validations method has been added to
4
- the auto_validations plugin, allowing you to skip all or specific
5
- types of auto validations inside the block:
6
-
7
- model_instance.skip_auto_validations(:unique) do
8
- puts model_instance.valid?
9
- end
10
-
11
- * A Database :preconnect_extensions option has been added. This
12
- option is similar to :extensions, but the extensions are loaded
13
- before the :preconnect option is processed. This allows you to
14
- use the server_logging extension with the :preconnect option.
15
-
16
- * For specifying custom table aliases when using eager_graph and
17
- association_join, you can now use:
18
-
19
- Sequel[:association].as(:table_alias)
20
-
21
- in addition to:
22
-
23
- Sequel.as(:association, :table_alias)
24
-
25
- = Other Improvements
26
-
27
- * The ado/mssql adapter now retrieves the number of deleted or
28
- updated rows for a query without issuing a separate query.
29
-
30
- * Sequel now avoids the use of Proc.new with an implicit block, as
31
- that feature will be deprecated starting in Ruby 2.7.
@@ -1,69 +0,0 @@
1
- = New Features
2
-
3
- * A throw_failures plugin has been added for throwing ValidationFailed
4
- and HookFailed exceptions instead of raising them. This can improve
5
- performance by up to 10x on JRuby and 10-15% on CRuby. However,
6
- you would need to modify your exception handling from:
7
-
8
- begin
9
- # model.save
10
- rescue Sequel::ValidationFailed => e
11
- # handle failure
12
- end
13
-
14
- to:
15
-
16
- e = catch(Sequel::ValidationFailed) do
17
- # model.save
18
- end
19
- if e.is_a?(Sequel::ValidationFailed)
20
- # handle failure
21
- end
22
-
23
- The throw_failures plugin will still work if you are not catching
24
- the exception, falling back to the default behavior of raising
25
- the exception.
26
-
27
- * SQL::Blob.call has been added, so that SQL::Blob can be used
28
- directly as a callable to create a new instance, resulting in
29
- better performance in cases where a callable is needed.
30
-
31
- = Other Improvements
32
-
33
- * Type conversion is many adapters is now faster by switching from
34
- Proc/Method instances to using singleton call methods on plain
35
- objects. This can improve performance of row fetching by up to
36
- 10% in some cases.
37
-
38
- * Row fetching is slightly faster in the jdbc and sqlite adapters,
39
- by switching from each to while.
40
-
41
- * tzinfo 2 is now supported when using the named_timezones extension.
42
- tzinfo 1 remains supported.
43
-
44
- * The optimized Dataset#paged_each methods in the postgres and mysql2
45
- adapters now support being called without a block, returning an
46
- Enumerator in that case, to mirror the behavior of the default
47
- Dataset#paged_each method.
48
-
49
- * Sequel no longer uses flow-control exceptions in the
50
- connection_expiration and connection_validator extensions,
51
- significantly improving performance on JRuby.
52
-
53
- * The after_initialize plugin no longer makes the argument to
54
- Model.call optional.
55
-
56
- = Backwards Compatibility
57
-
58
- * Some internal by not private constants and methods previously used
59
- for type conversion in adapters have been removed:
60
-
61
- * JDBC::Oracle.OracleDecimal
62
- * JDBC::Oracle.OracleClob
63
- * JDBC::Postgres.RubyPGArray
64
- * JDBC::Postgres.RubyPGHstore
65
- * JDBC::SqlAnywhere.SqlAnywhereBoolean
66
- * JDBC::SQLServer.MSSQLRubyTime
67
- * MySQL::TYPE_TRANSLATOR
68
- * Postgres::TYPE_TRANSLATOR
69
-
@@ -1,28 +0,0 @@
1
- = New Features
2
-
3
- * A Database#rename_enum_value method has been added to the pg_enum
4
- extension. It is supported on PostgreSQL 10+:
5
-
6
- DB.rename_enum_value(:enum_type, 'old_name', 'new_name')
7
-
8
- = Other Improvements
9
-
10
- * The performance of row fetching and type conversion in the
11
- sqlanywhere adapter has been improved.
12
-
13
- * The performance of row fetching in the sqlite adapter has been
14
- improved.
15
-
16
- * Calling Database#drop_table now drops any constraint validations
17
- metadata for the table if using the constraint_validations
18
- extension. However, modifying the table using Database#alter_table
19
- does not affect the constraint validations metadata.
20
-
21
- * The sqlite adapter when used with ruby-sqlite3 1.4.0+ now uses
22
- SQLite extended result codes for a more accurate determination of
23
- specific database errors types.
24
-
25
- * Performance for typecasting to decimal and floats has been improved
26
- slightly.
27
-
28
- * Performance when merging hashes has been improved slightly.
@@ -1,33 +0,0 @@
1
- = New Features
2
-
3
- * A pg_extended_date_support extension has been added. This
4
- extension adds support for infinite and BC dates/timestamps on
5
- PostgreSQL.
6
-
7
- The postgres adapter already had a convert_infinite_timestamps
8
- setting, but it wasn't supported in the jdbc/postgresql adapter
9
- and it didn't handle BC dates/timestamps. Setting a non-default
10
- convert_infinite_timestamps setting in the postgres adapter will
11
- now automatically load the extension for backwards compatibility.
12
-
13
- The pg_extended_date_support extension by default just fixes the
14
- handling of BC dates/timestamps. To get it to handle infinite
15
- timestamps, you need to choose the appropriate setting for your
16
- application:
17
-
18
- DB.extension :pg_extended_date_support
19
- DB.convert_infinite_timestamps = :string # or :float or :nil
20
-
21
- This extension also enables the handling of timezone offsets
22
- with seconds, which is not natively supported by ruby's Time
23
- class in ruby <2.5.
24
-
25
- = Improvements
26
-
27
- * The jdbc/mysql adapter now handles smallint unsigned and
28
- integer unsigned column types where the value for the column
29
- is outside of the range of a Java short or integer.
30
-
31
- * Sequel::Model.inherited no longer modifies an existing @dataset
32
- instance variable if one has already been set. This fixes a
33
- regression that was introduced in Sequel 5.0.0.
@@ -1,89 +0,0 @@
1
- = New Features
2
-
3
- * Database#after_commit and #after_rollback transaction hook methods
4
- now support a :savepoint option. Using the :savepoint option makes
5
- the hooks savepoint-aware, so after_commit will only be called if
6
- all enclosing savepoints and the transaction are committed, and
7
- after_rollback will be called when any of the enclosing savepoints
8
- are rolled back (which may be before transaction commit/rollback).
9
- Examples:
10
-
11
- x = nil
12
- DB.transaction do # BEGIN
13
- DB.transaction(savepoint: true) do # SAVEPOINT
14
- DB.after_commit(savepoint: true){x = 1}
15
- DB.after_rollback(savepoint: true){x = 2}
16
- x # nil
17
- end # RELEASE SAVEPOINT
18
- x # nil
19
- end # COMMIT
20
- x # 1
21
-
22
- x = nil
23
- DB.transaction do # BEGIN
24
- DB.transaction(savepoint: true) do # SAVEPOINT
25
- DB.after_commit(savepoint: true){x = 1}
26
- DB.after_rollback(savepoint: true){x = 2}
27
- x # nil
28
- raise Sequel::Rollback
29
- end # ROLLBACK TO SAVEPOINT
30
- x # 2
31
- end # COMMIT
32
- x # 2
33
-
34
- x = nil
35
- DB.transaction do # BEGIN
36
- DB.transaction(savepoint: true) do # SAVEPOINT
37
- DB.after_commit(savepoint: true){x = 1}
38
- DB.after_rollback(savepoint: true){x = 2}
39
- end # RELEASE SAVEPOINT
40
- x # nil
41
- raise Sequel::Rollback
42
- end
43
- x # 2
44
-
45
- * The pg_auto_constraint_validations plugin now supports a
46
- pg_auto_constraint_validation_override method for overriding
47
- the columns and message for a specific constraint. This is
48
- useful if the database cannot determine the columns (due
49
- to the constraint containing a database function call), or
50
- if you would like to customize the message per constraint.
51
-
52
- = Other Improvements
53
-
54
- * The one_to_one association setter now works with models that use
55
- joined datasets, such as child models when using the
56
- class_table_inheritance plugin.
57
-
58
- * Database#check_constraints on PostgreSQL now also includes CHECK
59
- constraints where the related columns are not known. The :columns
60
- entry in the hash will be an empty array in such cases. The
61
- exclusion of such constraints in previous versions was not
62
- intentional, and the documentation implied that all CHECK
63
- constraints were returned.
64
-
65
- * Many cases where instance_exec was previously used on model
66
- instances have been changed so that instance methods are defined
67
- and called instead. This avoids the creation of singleton classes
68
- for model instances, and can significantly improve performance in
69
- some cases. This affects all associations as well as the
70
- following plugins:
71
-
72
- * composition
73
- * hook_class_methods
74
- * validation_class_methods
75
-
76
- Other cases where instance_exec is now avoided and a different
77
- approach is used:
78
-
79
- * association_dependencies plugin
80
- * PlaceholderLiteralString#with_dataset
81
-
82
- * The auto_validations plugin now works with child models when using
83
- the class_table_inheritance plugin.
84
-
85
- * Database#server_version now works correctly in the mysql2 adapter
86
- when using the MySQL driver with MariaDB 10+.
87
-
88
- * The float unsigned type is now recognized and supported in the
89
- schema parser and schema_dumper extension.
@@ -1,87 +0,0 @@
1
- = New Features
2
-
3
- * The pg_json extension now adds a Database#wrap_json_primitives
4
- accessor. When set to true, JSON primitive values (string, number,
5
- true, false, and null) will be wrapped by delegate Ruby objects
6
- instead of using Ruby primitives. This allows the values to round
7
- trip, so the following code will work even for primitive values in
8
- json_column:
9
-
10
- DB.extension :pg_json
11
- DB.wrap_json_primitives = true
12
- value = DB[:table].get(:json_column)
13
- DB[:other_table].insert(json_column: value)
14
-
15
- This should be enabled with care, especially in cases where false
16
- and null JSON values are used, as the behavior will change if
17
- the objects are used in a boolean context in Ruby, as only false
18
- and nil in Ruby are treated as false:
19
-
20
- # assume JSON false or null value
21
- value = DB[:table].get(:json_column)
22
-
23
- if value
24
- # executed if wrap_json_primitives is true
25
- else
26
- # executed by default
27
- end
28
-
29
- When typecasting input in model objects to a JSON type, string
30
- input will still be parsed as JSON. However, you can set the
31
- Database#typecast_json_strings accessor to true, and then string
32
- input will be considered as a JSON string instead of parsing the
33
- string as JSON.
34
-
35
- To prevent backwards compatibility issues, Sequel.pg_json/pg_jsonb
36
- behavior has not changed. To support wrapping Ruby primitives in
37
- the delegate objects, new Sequel.pg_json_wrap/pg_jsonb_wrap methods
38
- have been added. These methods only handle the Ruby primitives,
39
- they cannot be used if the existing object is already a delegate
40
- object.
41
-
42
- As model objects always consider a nil value as SQL NULL and do
43
- not typecast it, if you want to explicitly set a JSON null value,
44
- you need to wrap it explicitly:
45
-
46
- model_object.json_column = Sequel.pg_json_wrap(nil)
47
-
48
- = Other Improvements
49
-
50
- * Sequel now supports window function options :window, :exclude, and
51
- :frame :type=>:groups, :start, and :end on SQLite 3.28.0+.
52
-
53
- * The server_block extension now respects the :servers_hash Database
54
- option. This makes it more similar to Sequel's default behavior.
55
- However, that means by default, the server_block extension will
56
- default to handling unknown shards as the default shard, instead
57
- of raising an error for them.
58
-
59
- * The rcte_tree plugin now disallows eager graphing of the ancestors
60
- and descendants associations. Previously, eager graphing of these
61
- associations generated incorrect results. It is not possible to
62
- eager graph these extensions, but normal eager loading does work.
63
-
64
- * The ado adapter's performance has been improved by using faster
65
- callables for type conversion and a more efficient inner loop.
66
-
67
- * The sqlite adapter now converts a :timeout option given as a string
68
- to an integer. This allows you to use the option inside of a
69
- connection string.
70
-
71
- * The mysql and mysql2 adapters now recognize an additional
72
- DatabaseLockTimeout error.
73
-
74
- * The jdbc/mysql adapter now works correctly when using JRuby with
75
- Java 11.
76
-
77
- * The ado adapter now handles numeric values when using locales that
78
- use comma instead of period as the decimal separator.
79
-
80
- = Backwards Compatibility
81
-
82
- * In the pg_json extension, the following singleton methods of
83
- Sequel::Postgres::JSONDatabaseMethods are now deprecated:
84
-
85
- * parse_json
86
- * db_parse_json
87
- * db_parse_jsonb
@@ -1,48 +0,0 @@
1
- = New Features
2
-
3
- * Sequel now supports Ruby 2.7+ startless ranges in filters:
4
-
5
- DB[:table].where(:column=>(..10))
6
- # SELECT * FROM table WHERE (column <= 10)
7
-
8
- DB[:table].where(:column=>(...10))
9
- # SELECT * FROM table WHERE (column < 10)
10
-
11
- It also supports startless, endless ranges in filters, using a
12
- condition that is always true:
13
-
14
- DB[:table].where(:column=>(nil..nil))
15
- # SELECT * FROM table WHERE (1 = 1)
16
-
17
- * Sequel now supports startless ranges in the pg_range extension:
18
-
19
- DB.extension :pg_range
20
-
21
- DB[:table].insert(:column=>(..10))
22
- # INSERT INTO "table" ("column") VALUES ('[,10]') RETURNING "id"
23
-
24
- DB[:table].insert(:column=>(...10))
25
- # INSERT INTO "table" ("column") VALUES ('[,10)') RETURNING "id"
26
-
27
- DB[:table].insert(:column=>(nil..nil))
28
- # INSERT INTO "table" ("column") VALUES ('[,]') RETURNING "id"
29
-
30
- * Sequel now supports a :materialized option in Dataset#with on
31
- PostgreSQL 12+, to control the inlining of common table expressions:
32
-
33
- DB[:t].with(:t, DB[:t2], :materialized=>false)
34
- # WITH "t" AS NOT MATERIALIZED (SELECT * FROM "t2")
35
- # SELECT * FROM "t"
36
-
37
- DB[:t].with(:t, DB[:t2], :materialized=>true)
38
- # WITH "t" AS MATERIALIZED (SELECT * FROM "t2")
39
- # SELECT * FROM "t"
40
-
41
- = Other Improvements
42
-
43
- * Database#primary_key_sequence now works for tables without serial
44
- sequences on PostgreSQL 12+.
45
-
46
- * Dataset#multi_insert and #import with return: :primary_key option
47
- on Microsoft SQL Server now work correctly if the dataset uses
48
- a row_proc (e.g. for model datasets).
@@ -1,56 +0,0 @@
1
- = New Features
2
-
3
- * An insert_conflict plugin has been added for automatically handling
4
- constraint conflicts when saving new model instances. It is
5
- supported on PostgreSQL 9.5+ and SQLite 3.24.0+.
6
-
7
- Album.new(name: 'Foo', copies_sold: 1000).
8
- insert_conflict(
9
- target: :name,
10
- update: {copies_sold: Sequel[:excluded][:b]}
11
- ).
12
- save
13
-
14
- * On Microsoft SQL Server, the Database :ansi option has been added,
15
- which sets the following ANSI related options:
16
-
17
- * ANSI_NULLS
18
- * ANSI_PADDING
19
- * ANSI_WARNINGS
20
- * ANSI_NULL_DFLT_ON
21
- * QUOTED_IDENTIFIER
22
- * CONCAT_NULL_YIELDS_NULL
23
-
24
- = Other Improvements
25
-
26
- * Sequel.datetime_class = Time is now supported when using the
27
- named_timezones extension. For backwards compatibility, the
28
- named_timezones extension still sets
29
- Sequel.datetime_class = DateTime. When using Ruby 2.6+, the
30
- Time instances have the timezone set on them using Ruby 2.6+'s
31
- timezone support, but basic support works correctly in earlier
32
- versions of Ruby.
33
-
34
- * On Microsoft SQL Server, Sequel now handles parsing schema for
35
- tables in another database on the same server or in a database
36
- on a linked server.
37
-
38
- * The pg_json extension now correctly handles subclasses of core
39
- classes when wrapping objects. This stopped working in Sequel
40
- 5.21.0, when support for wrapping JSON primitives was added.
41
-
42
- * Sequel now works around a couple bugs in jdbc-sqlite 3.27.2.1,
43
- allowing schema parsing and foreign key parsing to work.
44
-
45
- * Dataset#execute* private methods now respect an explicitly given
46
- :server option, fixing Dataset#paged_each in the postgres adapter
47
- when using sharding.
48
-
49
- * Timezone offsets are now handled correctly when typecasting an array
50
- or hash to datetime when Sequel.datetime_class = Time.
51
-
52
- * Sequel now avoids errors when parsing schema when using the mock
53
- SQLite adapter.
54
-
55
- * A minor thread-safety issue has been fixed in the named_timezones
56
- extension.