|
| 1 | += New Features |
| 2 | + |
| 3 | +* A pg_auto_parameterize_duplicate_query_detection extension has |
| 4 | + been added. This allows for detection of cases where the same |
| 5 | + SQL query (with potentially different parameters) is being sent |
| 6 | + to the database with the same callstack. This can detect most N+1 |
| 7 | + issues when the pg_auto_parameterize extension is used. |
| 8 | + |
| 9 | + To detect duplicate queries in a block of code, you wrap the code: |
| 10 | + |
| 11 | + DB.detect_duplicate_queries{your_code} |
| 12 | + |
| 13 | + If you are using Sequel in a web application, you can do this in |
| 14 | + a rack middleware to find N+1 issues in your application. Note that |
| 15 | + this may report duplicate queries that you may not consider to be |
| 16 | + problems. To ignore those cases, you can use: |
| 17 | + |
| 18 | + DB.ignore_duplicate_queries{your_code} |
| 19 | + |
| 20 | + By default, the extension will raise an exception for duplicate |
| 21 | + queries. It's possible to warn instead (handler: :warn) or to have |
| 22 | + custom behavior. It's also possible to filter the displayed |
| 23 | + backtraces (backtrace_filter: /\A#{Regexp.escape(Dir.pwd)}/). |
| 24 | + See the plugin documentation for more details. |
| 25 | + |
| 26 | +* Model#remove_key! has been added to remove a key from the instance's |
| 27 | + values. You could previously use values.delete(key), but that |
| 28 | + didn't necessarily work correctly when using the split_values plugin. |
| 29 | + |
| 30 | +* Model.any? has been added, which will call any? on the model's dataset |
| 31 | + instead of Enumerable#any?. This avoids unexpected behavior when using |
| 32 | + the any_not_empty extension. |
| 33 | + |
| 34 | += Other Improvements |
| 35 | + |
| 36 | +* The split_values plugin now supports eager loading associations that |
| 37 | + use join tables (e.g. many_to_many associations). |
| 38 | + |
| 39 | +* The rcte_tree plugin now works correctly when using the split_values |
| 40 | + plugin. |
| 41 | + |
| 42 | +* The insert_returning_select plugin now uses RETURNING * if the model |
| 43 | + uses SELECT table.* FROM table, allowing it to work better with the |
| 44 | + table_select plugin. |
| 45 | + |
| 46 | +* Database#listen in the postgres adapter now ignores all received |
| 47 | + notifications after it sends the UNLISTEN statement, so future calls |
| 48 | + to #listen do not return notifications from a previous call. |
| 49 | + |
| 50 | +* Sequel now recognizes sqlite:filename and amalgalite:filename |
| 51 | + connection strings, treating them like sqlite://filename and |
| 52 | + amalgalite://filename. |
0 commit comments