|
| 1 | += New Features |
| 2 | + |
| 3 | +* A query_blocker extension has been added, for blocking queries |
| 4 | + inside a block: |
| 5 | + |
| 6 | + DB.extension :query_blocker |
| 7 | + DB[:table].all # works |
| 8 | + DB.block_queries do |
| 9 | + DB[:table].all # raises |
| 10 | + end |
| 11 | + |
| 12 | + To handle concurrency, you can specify a scope for the block: |
| 13 | + |
| 14 | + DB.block_queries(scope: :thread) do |
| 15 | + # Block queries for current thread |
| 16 | + end |
| 17 | + |
| 18 | + DB.block_queries(scope: :fiber) do |
| 19 | + # Block queries for current fiber |
| 20 | + end |
| 21 | + |
| 22 | + In some cases, you may want to block queries in general, and only |
| 23 | + allow them in specific places. The query blocker extension |
| 24 | + supports this: |
| 25 | + |
| 26 | + DB.block_queries do |
| 27 | + # Queries blocked |
| 28 | + DB.allow_queries do |
| 29 | + # Queries allowed |
| 30 | + end |
| 31 | + # Queries blocked |
| 32 | + end |
| 33 | + |
| 34 | +* The alter_table add_primary_key and add_unique_constraint methods |
| 35 | + now support a :using_index option on PostgreSQL, to add the |
| 36 | + constraint using an existing index, instead of building a new |
| 37 | + unique index to enforce the constraint. |
| 38 | + |
| 39 | +* A :compare_connections_by_identity Database option is now |
| 40 | + supported, which can be set to false to not use compare_by_identity |
| 41 | + on hashes keyed by connections. This should only be used to work |
| 42 | + around bugs in other libraries or ruby implementations. |
| 43 | + |
| 44 | += Other Improvements |
| 45 | + |
| 46 | +* All anonymous classes and modules created by Sequel now have |
| 47 | + temporary names set when using Ruby 3.3+. This makes debugging |
| 48 | + and introspection easier. Example: |
| 49 | + |
| 50 | + class Foo < Sequel::Model(:foo) |
| 51 | + def_column_alias :a, :a |
| 52 | + puts ancestors[0..3] |
| 53 | + end |
| 54 | + |
| 55 | + Previous and when running on Ruby < 3.3 Output: |
| 56 | + |
| 57 | + Foo |
| 58 | + #<Module:0x00000846cf717aa0> |
| 59 | + #<Class:0x00000846cf718040> |
| 60 | + Sequel::Model |
| 61 | + |
| 62 | + New output when running on Ruby 3.3+: |
| 63 | + |
| 64 | + Foo |
| 65 | + Foo::@overridable_methods_module |
| 66 | + Sequel::_Model(:foo) |
| 67 | + Sequel::Model |
| 68 | + |
| 69 | +* The connection_validator extension now handles exceptions |
| 70 | + raised by Database#valid_connection?, which shouldn't happen, but |
| 71 | + would result in the thread/fiber being assigned the connection |
| 72 | + permanently in that case. |
| 73 | + |
| 74 | +* The mysql2 adapter now handles invalid statement handles when |
| 75 | + closing prepared statements. This only affected cases where |
| 76 | + you were changing the definition of already prepared statement. |
0 commit comments