sequel 5.60.1 → 5.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +280 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +27 -24
- data/doc/advanced_associations.rdoc +16 -14
- data/doc/association_basics.rdoc +53 -17
- data/doc/cheat_sheet.rdoc +3 -3
- data/doc/code_order.rdoc +5 -3
- data/doc/dataset_basics.rdoc +1 -1
- data/doc/mass_assignment.rdoc +1 -1
- data/doc/migration.rdoc +15 -0
- data/doc/model_hooks.rdoc +1 -1
- data/doc/object_model.rdoc +8 -8
- data/doc/opening_databases.rdoc +18 -7
- data/doc/postgresql.rdoc +8 -8
- data/doc/querying.rdoc +7 -2
- data/doc/release_notes/5.61.0.txt +43 -0
- data/doc/release_notes/5.62.0.txt +132 -0
- data/doc/release_notes/5.63.0.txt +33 -0
- data/doc/release_notes/5.64.0.txt +50 -0
- data/doc/release_notes/5.65.0.txt +21 -0
- data/doc/release_notes/5.66.0.txt +24 -0
- data/doc/release_notes/5.67.0.txt +32 -0
- data/doc/release_notes/5.68.0.txt +61 -0
- data/doc/release_notes/5.69.0.txt +26 -0
- data/doc/release_notes/5.70.0.txt +35 -0
- data/doc/release_notes/5.71.0.txt +21 -0
- data/doc/release_notes/5.72.0.txt +33 -0
- data/doc/release_notes/5.73.0.txt +66 -0
- data/doc/release_notes/5.74.0.txt +45 -0
- data/doc/release_notes/5.75.0.txt +35 -0
- data/doc/release_notes/5.76.0.txt +86 -0
- data/doc/release_notes/5.77.0.txt +63 -0
- data/doc/release_notes/5.78.0.txt +67 -0
- data/doc/release_notes/5.79.0.txt +28 -0
- data/doc/release_notes/5.80.0.txt +40 -0
- data/doc/release_notes/5.81.0.txt +31 -0
- data/doc/schema_modification.rdoc +3 -3
- data/doc/security.rdoc +9 -9
- data/doc/sharding.rdoc +3 -1
- data/doc/sql.rdoc +14 -14
- data/doc/testing.rdoc +16 -12
- data/doc/transactions.rdoc +6 -6
- data/doc/virtual_rows.rdoc +1 -1
- data/lib/sequel/adapters/ibmdb.rb +1 -1
- data/lib/sequel/adapters/jdbc/h2.rb +3 -0
- data/lib/sequel/adapters/jdbc/hsqldb.rb +2 -0
- data/lib/sequel/adapters/jdbc/postgresql.rb +3 -0
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +15 -0
- data/lib/sequel/adapters/jdbc/sqlserver.rb +4 -0
- data/lib/sequel/adapters/jdbc.rb +10 -6
- data/lib/sequel/adapters/mysql.rb +19 -7
- data/lib/sequel/adapters/mysql2.rb +2 -2
- data/lib/sequel/adapters/odbc/mssql.rb +1 -1
- data/lib/sequel/adapters/oracle.rb +1 -0
- data/lib/sequel/adapters/postgres.rb +10 -5
- data/lib/sequel/adapters/shared/access.rb +9 -1
- data/lib/sequel/adapters/shared/db2.rb +12 -0
- data/lib/sequel/adapters/shared/mssql.rb +71 -9
- data/lib/sequel/adapters/shared/mysql.rb +82 -3
- data/lib/sequel/adapters/shared/oracle.rb +17 -7
- data/lib/sequel/adapters/shared/postgres.rb +469 -160
- data/lib/sequel/adapters/shared/sqlanywhere.rb +18 -5
- data/lib/sequel/adapters/shared/sqlite.rb +39 -3
- data/lib/sequel/adapters/sqlite.rb +42 -3
- data/lib/sequel/adapters/trilogy.rb +117 -0
- data/lib/sequel/connection_pool/sharded_threaded.rb +16 -11
- data/lib/sequel/connection_pool/sharded_timed_queue.rb +374 -0
- data/lib/sequel/connection_pool/threaded.rb +14 -8
- data/lib/sequel/connection_pool/timed_queue.rb +270 -0
- data/lib/sequel/connection_pool.rb +57 -31
- data/lib/sequel/database/connecting.rb +25 -1
- data/lib/sequel/database/dataset.rb +16 -6
- data/lib/sequel/database/misc.rb +65 -14
- data/lib/sequel/database/query.rb +72 -1
- data/lib/sequel/database/schema_generator.rb +1 -1
- data/lib/sequel/database/schema_methods.rb +12 -5
- data/lib/sequel/database/transactions.rb +6 -0
- data/lib/sequel/dataset/actions.rb +60 -13
- data/lib/sequel/dataset/dataset_module.rb +1 -1
- data/lib/sequel/dataset/deprecated_singleton_class_methods.rb +42 -0
- data/lib/sequel/dataset/features.rb +15 -1
- data/lib/sequel/dataset/graph.rb +1 -0
- data/lib/sequel/dataset/misc.rb +12 -2
- data/lib/sequel/dataset/placeholder_literalizer.rb +20 -9
- data/lib/sequel/dataset/query.rb +119 -45
- data/lib/sequel/dataset/sql.rb +58 -36
- data/lib/sequel/dataset.rb +4 -0
- data/lib/sequel/exceptions.rb +5 -0
- data/lib/sequel/extensions/_model_pg_row.rb +0 -12
- data/lib/sequel/extensions/_pretty_table.rb +1 -1
- data/lib/sequel/extensions/any_not_empty.rb +2 -2
- data/lib/sequel/extensions/async_thread_pool.rb +21 -13
- data/lib/sequel/extensions/auto_cast_date_and_time.rb +94 -0
- data/lib/sequel/extensions/auto_literal_strings.rb +1 -1
- data/lib/sequel/extensions/caller_logging.rb +4 -1
- data/lib/sequel/extensions/connection_expiration.rb +15 -9
- data/lib/sequel/extensions/connection_validator.rb +16 -11
- data/lib/sequel/extensions/constraint_validations.rb +1 -1
- data/lib/sequel/extensions/date_arithmetic.rb +1 -1
- data/lib/sequel/extensions/duplicate_columns_handler.rb +10 -9
- data/lib/sequel/extensions/index_caching.rb +5 -1
- data/lib/sequel/extensions/looser_typecasting.rb +3 -0
- data/lib/sequel/extensions/migration.rb +65 -15
- data/lib/sequel/extensions/named_timezones.rb +22 -6
- data/lib/sequel/extensions/pg_array.rb +33 -4
- data/lib/sequel/extensions/pg_auto_parameterize.rb +509 -0
- data/lib/sequel/extensions/pg_auto_parameterize_in_array.rb +110 -0
- data/lib/sequel/extensions/pg_enum.rb +1 -2
- data/lib/sequel/extensions/pg_extended_date_support.rb +38 -27
- data/lib/sequel/extensions/pg_extended_integer_support.rb +116 -0
- data/lib/sequel/extensions/pg_hstore.rb +5 -0
- data/lib/sequel/extensions/pg_inet.rb +10 -11
- data/lib/sequel/extensions/pg_interval.rb +10 -11
- data/lib/sequel/extensions/pg_json.rb +10 -10
- data/lib/sequel/extensions/pg_json_ops.rb +3 -3
- data/lib/sequel/extensions/pg_multirange.rb +6 -11
- data/lib/sequel/extensions/pg_range.rb +9 -14
- data/lib/sequel/extensions/pg_row.rb +20 -19
- data/lib/sequel/extensions/pg_timestamptz.rb +27 -3
- data/lib/sequel/extensions/provenance.rb +110 -0
- data/lib/sequel/extensions/round_timestamps.rb +1 -1
- data/lib/sequel/extensions/schema_caching.rb +1 -1
- data/lib/sequel/extensions/schema_dumper.rb +32 -9
- data/lib/sequel/extensions/server_block.rb +2 -1
- data/lib/sequel/extensions/set_literalizer.rb +58 -0
- data/lib/sequel/extensions/sqlite_json_ops.rb +76 -18
- data/lib/sequel/extensions/temporarily_release_connection.rb +178 -0
- data/lib/sequel/extensions/transaction_connection_validator.rb +78 -0
- data/lib/sequel/model/associations.rb +38 -11
- data/lib/sequel/model/base.rb +32 -18
- data/lib/sequel/model/dataset_module.rb +3 -0
- data/lib/sequel/model/exceptions.rb +15 -3
- data/lib/sequel/plugins/auto_validations.rb +53 -15
- data/lib/sequel/plugins/class_table_inheritance.rb +2 -2
- data/lib/sequel/plugins/column_encryption.rb +28 -7
- data/lib/sequel/plugins/composition.rb +2 -2
- data/lib/sequel/plugins/concurrent_eager_loading.rb +4 -4
- data/lib/sequel/plugins/constraint_validations.rb +8 -5
- data/lib/sequel/plugins/defaults_setter.rb +16 -0
- data/lib/sequel/plugins/dirty.rb +1 -1
- data/lib/sequel/plugins/finder.rb +4 -2
- data/lib/sequel/plugins/input_transformer.rb +1 -1
- data/lib/sequel/plugins/list.rb +5 -2
- data/lib/sequel/plugins/many_through_many.rb +1 -1
- data/lib/sequel/plugins/mssql_optimistic_locking.rb +8 -38
- data/lib/sequel/plugins/nested_attributes.rb +4 -4
- data/lib/sequel/plugins/optimistic_locking.rb +9 -42
- data/lib/sequel/plugins/optimistic_locking_base.rb +55 -0
- data/lib/sequel/plugins/paged_operations.rb +181 -0
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +9 -3
- data/lib/sequel/plugins/pg_xmin_optimistic_locking.rb +109 -0
- data/lib/sequel/plugins/prepared_statements.rb +2 -1
- data/lib/sequel/plugins/prepared_statements_safe.rb +2 -1
- data/lib/sequel/plugins/primary_key_lookup_check_values.rb +154 -0
- data/lib/sequel/plugins/rcte_tree.rb +7 -4
- data/lib/sequel/plugins/single_table_inheritance.rb +8 -0
- data/lib/sequel/plugins/sql_comments.rb +1 -1
- data/lib/sequel/plugins/static_cache.rb +38 -0
- data/lib/sequel/plugins/static_cache_cache.rb +5 -1
- data/lib/sequel/plugins/tactical_eager_loading.rb +14 -14
- data/lib/sequel/plugins/validate_associated.rb +22 -12
- data/lib/sequel/plugins/validation_helpers.rb +29 -2
- data/lib/sequel/plugins/validation_helpers_generic_type_messages.rb +73 -0
- data/lib/sequel/version.rb +2 -2
- metadata +79 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a23afa1510b7bd1ba6918319eedce156450672520ab4798e6de56461a59660e1
|
|
4
|
+
data.tar.gz: bb6bbfbf0f1f82fe117fa8c725e9cf4fde49644a74b463ab8682018744a8a1de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e26620f8f1df2715205e9019c2012ec2e9f392d14ed427d66c76f488bccc3e5d3f27e4d626a47d54903d611695db0487f987d99191602024a1864d6c10f7bde
|
|
7
|
+
data.tar.gz: cd070d8c35960949039d226b5eaf8c90ebec8d0cef3f09b5dae533551bb35170ca6e2503d88f1b1512110b6617ff9c03d9cb2afb62395c4d953314aa5a5ca87c
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,283 @@
|
|
|
1
|
+
=== 5.81.0 (2024-06-01)
|
|
2
|
+
|
|
3
|
+
* Fix ignored block warnings in a couple plugin apply methods on Ruby 3.4 (jeremyevans)
|
|
4
|
+
|
|
5
|
+
* Skip Ruby internal caller locations when searching for caller locations in caller_logging and provenance extensions (jeremyevans)
|
|
6
|
+
|
|
7
|
+
* Add temporarily_release_connection Database extension for multithreaded transactional testing (jeremyevans)
|
|
8
|
+
|
|
9
|
+
=== 5.80.0 (2024-05-01)
|
|
10
|
+
|
|
11
|
+
* Support Dataset#skip_locked on MariaDB 10.6+ (simi) (#2150)
|
|
12
|
+
|
|
13
|
+
* Avoid allocating datasets in cases where the returned dataset would be the same as the receiver (jeremyevans)
|
|
14
|
+
|
|
15
|
+
* Add provenance dataset extension, which includes comments in queries showing how and where the dataset was built (jeremyevans)
|
|
16
|
+
|
|
17
|
+
=== 5.79.0 (2024-04-01)
|
|
18
|
+
|
|
19
|
+
* Support create_or_replace_view with :materialized option on PostgreSQL (nashby) (#2144)
|
|
20
|
+
|
|
21
|
+
* Support :unlogged_tables_default Database option on Postgres for making created tables unlogged by default (jeremyevans) (#2134)
|
|
22
|
+
|
|
23
|
+
* Add Dataset#select_prepend for prepending to the current selected columns (jeremyevans) (#2139)
|
|
24
|
+
|
|
25
|
+
=== 5.78.0 (2024-03-01)
|
|
26
|
+
|
|
27
|
+
* Support SQLite 3.45+ jsonb functions in the sqlite_json_ops extension (jeremyevans) (#2133)
|
|
28
|
+
|
|
29
|
+
* Support compounds (e.g. UNION) in conjunction with Database#values on PostgreSQL (jeremyevans) (#2137)
|
|
30
|
+
|
|
31
|
+
* Support :use_advisory_lock option to Migrator.run to use advisory locks when running migrations (jeremyevans) (#2089)
|
|
32
|
+
|
|
33
|
+
* Support Database#with_advisory_lock on PostgreSQL, MySQL, and Microsoft SQL Server (jeremyevans) (#2089)
|
|
34
|
+
|
|
35
|
+
=== 5.77.0 (2024-02-01)
|
|
36
|
+
|
|
37
|
+
* Support create_table :without_rowid option on SQLite (loranger32) (#2126)
|
|
38
|
+
|
|
39
|
+
* Warn by default if trying to eager_graph/association_join an association that uses a block, when the block would be ignored (jeremyevans)
|
|
40
|
+
|
|
41
|
+
* Speed up validates_unique in validation_helpers plugin by using empty? instead of count == 0 (numbata) (#2122)
|
|
42
|
+
|
|
43
|
+
* Speed up regexp matches in sqlite adapter on Ruby 2.4+ (jeremyevans)
|
|
44
|
+
|
|
45
|
+
* Add sqlite adapter :regexp_function_cache option for specifying the cache object to use (paddor, jeremyevans) (#2116)
|
|
46
|
+
|
|
47
|
+
* Respect list plugin :top option when inserting the first row into the model's table (johanmagnusson) (#2115)
|
|
48
|
+
|
|
49
|
+
* Switch default connection pool to timed_queue on Ruby 3.4+ (jeremyevans)
|
|
50
|
+
|
|
51
|
+
* Support on_duplicate_columns={raise,warn} parameter in connection URL when using duplicate_columns_handler extension (jeremyevans)
|
|
52
|
+
|
|
53
|
+
* Add transaction_connection_validator extension for retrying transactions on new connection if there is a disconnect error when starting transaction (jeremyevans)
|
|
54
|
+
|
|
55
|
+
=== 5.76.0 (2024-01-01)
|
|
56
|
+
|
|
57
|
+
* Improve performance and flexibility of regexp matching in sqlite adapter (paddor) (#2108)
|
|
58
|
+
|
|
59
|
+
* Support SQL::Identifier for Database#tables :schema option values on PostgreSQL (jeremyevans)
|
|
60
|
+
|
|
61
|
+
* Support generating rcte queries using UNION or UNION ALL in the rcte plugin (jonathanfrias) (#2107)
|
|
62
|
+
|
|
63
|
+
* Make Database#table_exists? on PostgreSQL handle lock or statement timeout errors as evidence the table exists (jeremyevans) (#2106)
|
|
64
|
+
|
|
65
|
+
* Work around DateTime.jd fractional second bug on JRuby in named_timezones extension (jeremyevans)
|
|
66
|
+
|
|
67
|
+
* Support fractional times and timestamps on SQLAnywhere (jeremyevans)
|
|
68
|
+
|
|
69
|
+
* Make round_timestamps extension use Dataset#sqltime_precision for rounding Sequel::SQLTime values (jeremyevans)
|
|
70
|
+
|
|
71
|
+
* Remove special handling of %N modifier in Dataset#default_timestamp_format (jeremyevans)
|
|
72
|
+
|
|
73
|
+
* Add Dataset#default_time_format private method, for adapters to override for time (not timestamp) formatting (jeremyevans)
|
|
74
|
+
|
|
75
|
+
* Remove Dataset#format_timestamp_offset private method (jeremyevans)
|
|
76
|
+
|
|
77
|
+
* Remove special handling of %z modifier in Dataset#default_timestamp_format (jeremyevans)
|
|
78
|
+
|
|
79
|
+
* Add Dataset#literal_date_or_time, for simpler use by bound argument code (jeremyevans)
|
|
80
|
+
|
|
81
|
+
* Add auto_cast_date_and_time extension, for casting date and time values using SQL standard functions (jeremyevans)
|
|
82
|
+
|
|
83
|
+
=== 5.75.0 (2023-12-01)
|
|
84
|
+
|
|
85
|
+
* Make any_not_empty? extension support passing pattern argument to any? (jeremyevans) (#2100)
|
|
86
|
+
|
|
87
|
+
* Respect :skip_transaction option in PostgreSQL Dataset#paged_each (jeremyevans) (#2097)
|
|
88
|
+
|
|
89
|
+
* Add TimestampMigrator.run_single to run a single migration file up or down (opya, jeremyevans) (#2093)
|
|
90
|
+
|
|
91
|
+
* Support INSERT RETURNING on MariaDB 10.5+, and use it when saving new model objects (jeremyevans)
|
|
92
|
+
|
|
93
|
+
* Add Database#{defer,immediate}_constraints on PostgreSQL for changing handling of deferrable constraints in a transaction (jeremyevans)
|
|
94
|
+
|
|
95
|
+
=== 5.74.0 (2023-11-01)
|
|
96
|
+
|
|
97
|
+
* Make generated columns show up in Database#schema when using SQLite 3.37+ (jeremyevans) (#2087)
|
|
98
|
+
|
|
99
|
+
* Add revert method for Sequel.migration blocks, to revert changes inside the block on up, and apply the changes on down (jeremyevans)
|
|
100
|
+
|
|
101
|
+
* Re-add is_json and is_not_json methods to the pg_json_ops extension, as the support was re-added in PostgreSQL 16 (jeremyevans)
|
|
102
|
+
|
|
103
|
+
* Avoid infinite loop when handling exceptions with a cause loop in jdbc adapter (jeremyevans)
|
|
104
|
+
|
|
105
|
+
=== 5.73.0 (2023-10-01)
|
|
106
|
+
|
|
107
|
+
* Handle disconnect errors in ibmdb and jdbc/db2 adapters (jeremyevans) (#2083)
|
|
108
|
+
|
|
109
|
+
* Support skipping transactions in Dataset#{import,paged_each} using :skip_transaction option (jeremyevans)
|
|
110
|
+
|
|
111
|
+
* Add Database#transaction :skip_transaction option to skip creating a transaction or savepoint (jeremyevans)
|
|
112
|
+
|
|
113
|
+
* Stop using a transaction for a single query if calling Dataset#import with a dataset (jeremyevans)
|
|
114
|
+
|
|
115
|
+
* Add paged_operations plugin for paged deletes and updates and other custom operations (jeremyevans) (#2080)
|
|
116
|
+
|
|
117
|
+
* Support to_tsquery: :websearch option to Dataset#full_text_search on PostgreSQL 11+ (jeremyevans) (#2075)
|
|
118
|
+
|
|
119
|
+
* Add MassAssignmentRestriction#model and #column for getting the model instance and related column for mass assignment errors (artofhuman, jeremyevans) (#2079)
|
|
120
|
+
|
|
121
|
+
* Stop using base64 library in column_encryption plugin (jeremyevans)
|
|
122
|
+
|
|
123
|
+
=== 5.72.0 (2023-09-01)
|
|
124
|
+
|
|
125
|
+
* Sort caches before marshalling when using schema_caching, index_caching, static_cache_cache, and pg_auto_constraint_validations (jeremyevans)
|
|
126
|
+
|
|
127
|
+
* Change the defaults_setter plugin do a deep-copy of database default hash/array values and delegates (jeremyevans) (#2069)
|
|
128
|
+
|
|
129
|
+
* Add pg_auto_parameterize_in_array extension, for converting IN/NOT IN to = ANY or != ALL for more types (jeremyevans)
|
|
130
|
+
|
|
131
|
+
* Fix literalization of infinite and NaN float values in PostgreSQL array bound variables (jeremyevans)
|
|
132
|
+
|
|
133
|
+
=== 5.71.0 (2023-08-01)
|
|
134
|
+
|
|
135
|
+
* Support ILIKE ANY on PostgreSQL by not forcing the use of ESCAPE for ILIKE (gilesbowkett) (#2066)
|
|
136
|
+
|
|
137
|
+
* Add pg_xmin_optimistic_locking plugin for optimistic locking for all models without database changes (jeremyevans)
|
|
138
|
+
|
|
139
|
+
* Recognize the xid PostgreSQL type as an integer type in the jdbc/postgresql adapter (jeremyevans)
|
|
140
|
+
|
|
141
|
+
* Make set_column_allow_null method reversible in migrations (enescakir) (#2060)
|
|
142
|
+
|
|
143
|
+
=== 5.70.0 (2023-07-01)
|
|
144
|
+
|
|
145
|
+
* Make static_cache plugin better handle cases where forbid_lazy_load plugin is already loaded (jeremyevans)
|
|
146
|
+
|
|
147
|
+
* Fix ShardedThreadedConnectionPool#remove_server to disconnect all connections if removing multiple servers (jeremyevans)
|
|
148
|
+
|
|
149
|
+
* Support SEQUEL_DEFAULT_CONNECTION_POOL environment variable for choosing connection pool when :pool_class Database option is not set (jeremyevans)
|
|
150
|
+
|
|
151
|
+
* Add sharded_timed_queue connection pool (jeremyevans)
|
|
152
|
+
|
|
153
|
+
* Make connection_{validator,expiration} and async_thread_pool extensions work with timed_queue connection pool (jeremyevans)
|
|
154
|
+
|
|
155
|
+
* Make connection_{validator,expiration} extensions raise error when used with single threaded pools (HoneyryderChuck, jeremyevans) (#2049)
|
|
156
|
+
|
|
157
|
+
* Workaround possible resource starvation in threaded connection pool (ioquatix) (#2048)
|
|
158
|
+
|
|
159
|
+
=== 5.69.0 (2023-06-01)
|
|
160
|
+
|
|
161
|
+
* Avoid unsupported flag warning when using the mysql adapter with ruby-mysql 3+ (jeremyevans)
|
|
162
|
+
|
|
163
|
+
* Make mysql adapter work with ruby-mysql 4+ (jeremyevans)
|
|
164
|
+
|
|
165
|
+
* Add Model::DatasetModule#model accessor (davekaro) (#2040)
|
|
166
|
+
|
|
167
|
+
* Add trilogy adapter (jeremyevans)
|
|
168
|
+
|
|
169
|
+
=== 5.68.0 (2023-05-01)
|
|
170
|
+
|
|
171
|
+
* Add validation_helpers_generic_type_messages plugin for more useful type validation failure messages (jeremyevans) (#2028)
|
|
172
|
+
|
|
173
|
+
* Make constraint_validations plugin not validate missing columns that have a default value (jeremyevans) (#2023)
|
|
174
|
+
|
|
175
|
+
* Skip normal type name parsing for enum/array/composite/range/multirange types on PostgreSQL (jeremyevans) (#2019)
|
|
176
|
+
|
|
177
|
+
* Fix corner case where pg_extended_date_support did not work correctly when using the jdbc/postgresql adapter (jeremyevans)
|
|
178
|
+
|
|
179
|
+
* Include :min_value and :max_value schema entries for date/timestamp/timestamptz columns on PostgreSQL 9.6+ (jeremyevans)
|
|
180
|
+
|
|
181
|
+
=== 5.67.0 (2023-04-01)
|
|
182
|
+
|
|
183
|
+
* Fix dumping of string column sizes in the schema dumper on MSSQL (jeremyevans) (#2013)
|
|
184
|
+
|
|
185
|
+
* Improve dumping of tables in non-default schemas in the schema_dumper extension (jeremyevans) (#2006)
|
|
186
|
+
|
|
187
|
+
* Make Database#{tables,views} support :qualify option on Microsoft SQL Server (jeremyevans)
|
|
188
|
+
|
|
189
|
+
* Avoid use of singleton classes for datasets instances on Ruby 2.4+ (jeremyevans) (#2007)
|
|
190
|
+
|
|
191
|
+
* Deprecate registering datasets extensions using an object other than a module (jeremyevans)
|
|
192
|
+
|
|
193
|
+
* Add set_literalizer extension, for treating set usage in datasets similar to array usage (jeremyevans) (#1997)
|
|
194
|
+
|
|
195
|
+
=== 5.66.0 (2023-03-01)
|
|
196
|
+
|
|
197
|
+
* Recognize SQLite error related to strict tables as a constraint violation when using the amalgalite adapter (jeremyevans)
|
|
198
|
+
|
|
199
|
+
* Make Dataset#count work correctly for datasets using Dataset#values (jeremyevans) (#1992)
|
|
200
|
+
|
|
201
|
+
* Make Dataset#count with no argument/block handle dataset with custom SQL using ORDER BY on MSSQL (jeremyevans)
|
|
202
|
+
|
|
203
|
+
* Make Dataset#empty? correctly handle datasets with custom SQL or using Dataset#values where the first value is NULL (andy-k, jeremyevans) (#1990)
|
|
204
|
+
|
|
205
|
+
=== 5.65.0 (2023-02-01)
|
|
206
|
+
|
|
207
|
+
* Allow pg_auto_parameterize extension to use placeholder loaders (jeremyevans)
|
|
208
|
+
|
|
209
|
+
* Do not include :min_value and :max_value schema entries for decimal/numeric columns on MySQL versions not supporting check constraints (jeremyevans)
|
|
210
|
+
|
|
211
|
+
* Make Database#indexes return indexes for partitioned tables on PostgreSQL 11+ (jeremyevans)
|
|
212
|
+
|
|
213
|
+
=== 5.64.0 (2023-01-01)
|
|
214
|
+
|
|
215
|
+
* Make :db_type column schema entries on SQLAnywhere include precision/scale information (jeremyevans)
|
|
216
|
+
|
|
217
|
+
* Include :min_value and :max_value schema entries for decimal/numeric columns on most databases (rolftimmermans, jeremyevans) (#1975)
|
|
218
|
+
|
|
219
|
+
* Support :graph_use_association_block association option to make eager_graph use the association block (jeremyevans)
|
|
220
|
+
|
|
221
|
+
* Make many_through_many and many_through_one associations support eager_graph callbacks (jeremyevans)
|
|
222
|
+
|
|
223
|
+
=== 5.63.0 (2022-12-01)
|
|
224
|
+
|
|
225
|
+
* Make validates_associated plugin avoid database type errors for non-integer association keys (jeremyevans) (#1968)
|
|
226
|
+
|
|
227
|
+
* Make tactical_eager_loading plugin work better with table inheritance plugins (rolftimmermans, jeremyevans) (#1962)
|
|
228
|
+
|
|
229
|
+
* Add support for pool_class: :timed_queue on Ruby 3.2+, using a Queue for available connections (jeremyevans)
|
|
230
|
+
|
|
231
|
+
* Allow :pool_class Database option to be specified as a string to more easily choose a different pool type (jeremyevans)
|
|
232
|
+
|
|
233
|
+
* Use compare_by_identity hashes for Thread-keyed hashes in threaded connection pools (jeremyevans)
|
|
234
|
+
|
|
235
|
+
* Skip use of JRuby workaround on JRuby 9.3.9.0+ in named_timezones extension as JRuby fixed the related bug (jeremyevans)
|
|
236
|
+
|
|
237
|
+
=== 5.62.0 (2022-11-01)
|
|
238
|
+
|
|
239
|
+
* Add back the pg_auto_parameterize extension for automatically using bound variables when using postgres adapter with pg driver (jeremyevans)
|
|
240
|
+
|
|
241
|
+
* Add pg_extended_integer_support extension for customizing behavior when literalizing a Ruby integer outside PostgreSQL bigint range (jeremyevans)
|
|
242
|
+
|
|
243
|
+
* Raise Postgres::IntegerOutsideBigintRange if attempting to literalize a Ruby integer outside PostgreSQL bigint range (jeremyevans)
|
|
244
|
+
|
|
245
|
+
* Add primary_key_lookup_check_values plugin for typecasting and checking primary key values during lookup (jeremyevans)
|
|
246
|
+
|
|
247
|
+
* Setup validation of minimum and maximum values for integer columns in auto_validations (jeremyevans)
|
|
248
|
+
|
|
249
|
+
* Add validates_max_value and validates_min_value to validation_helpers (jeremyevans)
|
|
250
|
+
|
|
251
|
+
* Include :min_value and :max_value schema entries for integer columns on most databases (jeremyevans)
|
|
252
|
+
|
|
253
|
+
* Don't wrap multi-inserts in a transaction when it's not required (shannoncole, jeremyevans) (#1945)
|
|
254
|
+
|
|
255
|
+
* Update mock PostgreSQL adapter to default to PostgreSQL 15 instead of PostgreSQL 14 (jeremyevans)
|
|
256
|
+
|
|
257
|
+
* Support fractional seconds in the named_timezones extension (jeremyevans) (#1943)
|
|
258
|
+
|
|
259
|
+
* Cache reflection datasets in the postgres adapter to improve performance (jeremyevans)
|
|
260
|
+
|
|
261
|
+
* Handle BC dates and timestamps in bound variables when using the pg_extended_date_support extension (jeremyevans)
|
|
262
|
+
|
|
263
|
+
* Correctly format hstore[] types in bound variables on PostgreSQL (jeremyevans)
|
|
264
|
+
|
|
265
|
+
* Fix corner case in eager loading where window function eager limit strategy is used, but row number entry is not removed (jeremyevans)
|
|
266
|
+
|
|
267
|
+
* Support server/shard specific :after_connect and :connect_sqls Database options (jeremyevans) (#1935)
|
|
268
|
+
|
|
269
|
+
=== 5.61.0 (2022-10-01)
|
|
270
|
+
|
|
271
|
+
* Make Database#foreign_key_list on PostgreSQL return results for partitioned tables (jeremyevans)
|
|
272
|
+
|
|
273
|
+
* Add Database#check_string_typecast_bytesize for checking bytesize of strings before typecasting (jeremyevans)
|
|
274
|
+
|
|
275
|
+
* Treat negative hexidecimal strings similar to positive hexidecimal strings when typecasting to integer (jeremyevans)
|
|
276
|
+
|
|
277
|
+
* Remove is_json and is_not_json methods from the pg_json_ops extension, as the support was removed in PostgreSQL 15 beta 4 (jeremyevans)
|
|
278
|
+
|
|
279
|
+
* Fix handling of timestamps before the date of calendar reform when using pg_extended_date_support extension on Ruby 3.2 (jeremyevans)
|
|
280
|
+
|
|
1
281
|
=== 5.60.1 (2022-09-02)
|
|
2
282
|
|
|
3
283
|
* Revert conversion of respond_to? to defined?, as it breaks with unused refinements on Ruby 2 (jeremyevans) (#1919)
|
data/MIT-LICENSE
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Copyright (c) 2007-2008 Sharon Rosner
|
|
2
|
-
Copyright (c) 2008-
|
|
2
|
+
Copyright (c) 2008-2023 Jeremy Evans
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to
|
data/README.rdoc
CHANGED
|
@@ -13,7 +13,7 @@ toolkit for Ruby.
|
|
|
13
13
|
database sharding.
|
|
14
14
|
* Sequel currently has adapters for ADO, Amalgalite,
|
|
15
15
|
IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle,
|
|
16
|
-
PostgreSQL, SQLAnywhere, SQLite3, and
|
|
16
|
+
PostgreSQL, SQLAnywhere, SQLite3, TinyTDS, and Trilogy.
|
|
17
17
|
|
|
18
18
|
== Resources
|
|
19
19
|
|
|
@@ -22,10 +22,11 @@ RDoc Documentation :: https://sequel.jeremyevans.net/rdoc
|
|
|
22
22
|
Source Code :: https://github.com/jeremyevans/sequel
|
|
23
23
|
Bug tracking (GitHub Issues) :: https://github.com/jeremyevans/sequel/issues
|
|
24
24
|
Discussion Forum (GitHub Discussions) :: https://github.com/jeremyevans/sequel/discussions
|
|
25
|
-
|
|
25
|
+
Archived Discussion Forum (sequel-talk Google Group) :: https://www.mail-archive.com/sequel-talk@googlegroups.com/
|
|
26
26
|
|
|
27
|
-
If you have questions about how to use Sequel, please ask on
|
|
28
|
-
|
|
27
|
+
If you have questions about how to use Sequel, please ask on
|
|
28
|
+
GitHub Discussions.
|
|
29
|
+
Only use the the bug tracker to report
|
|
29
30
|
bugs in Sequel, not to ask for help on using Sequel.
|
|
30
31
|
|
|
31
32
|
To check out the source code:
|
|
@@ -55,9 +56,9 @@ If you have any comments or suggestions please post to the Google group.
|
|
|
55
56
|
items = DB[:items] # Create a dataset
|
|
56
57
|
|
|
57
58
|
# Populate the table
|
|
58
|
-
items.insert(:
|
|
59
|
-
items.insert(:
|
|
60
|
-
items.insert(:
|
|
59
|
+
items.insert(name: 'abc', price: rand * 100)
|
|
60
|
+
items.insert(name: 'def', price: rand * 100)
|
|
61
|
+
items.insert(name: 'ghi', price: rand * 100)
|
|
61
62
|
|
|
62
63
|
# Print out the number of records
|
|
63
64
|
puts "Item count: #{items.count}"
|
|
@@ -83,7 +84,7 @@ Sequel uses the concept of datasets to retrieve data. A Dataset object encapsula
|
|
|
83
84
|
|
|
84
85
|
For example, the following one-liner returns the average GDP for countries in the middle east region:
|
|
85
86
|
|
|
86
|
-
DB[:countries].where(:
|
|
87
|
+
DB[:countries].where(region: 'Middle East').avg(:GDP)
|
|
87
88
|
|
|
88
89
|
Which is equivalent to:
|
|
89
90
|
|
|
@@ -91,7 +92,7 @@ Which is equivalent to:
|
|
|
91
92
|
|
|
92
93
|
Since datasets retrieve records only when needed, they can be stored and later reused. Records are fetched as hashes, and are accessed using an +Enumerable+ interface:
|
|
93
94
|
|
|
94
|
-
middle_east = DB[:countries].where(:
|
|
95
|
+
middle_east = DB[:countries].where(region: 'Middle East')
|
|
95
96
|
middle_east.order(:name).each{|r| puts r[:name]}
|
|
96
97
|
|
|
97
98
|
Sequel also offers convenience methods for extracting data from Datasets, such as an extended +map+ method:
|
|
@@ -209,12 +210,12 @@ If the dataset is ordered, you can also ask for the last record:
|
|
|
209
210
|
|
|
210
211
|
You can also provide a filter when asking for a single record:
|
|
211
212
|
|
|
212
|
-
posts.first(:
|
|
213
|
+
posts.first(id: 1)
|
|
213
214
|
# SELECT * FROM posts WHERE id = 1 LIMIT 1
|
|
214
215
|
|
|
215
216
|
Or retrieve a single value for a specific record:
|
|
216
217
|
|
|
217
|
-
posts.where(:
|
|
218
|
+
posts.where(id: 1).get(:name)
|
|
218
219
|
# SELECT name FROM posts WHERE id = 1 LIMIT 1
|
|
219
220
|
|
|
220
221
|
=== Filtering Records
|
|
@@ -367,10 +368,12 @@ Like +order+, +select+ overrides an existing selection:
|
|
|
367
368
|
posts.select(:stamp).select(:name)
|
|
368
369
|
# SELECT name FROM posts
|
|
369
370
|
|
|
370
|
-
As you might expect, there
|
|
371
|
+
As you might expect, there are +order_append+ and +order_prepend+ equivalents for +select+ called +select_append+ and +select_prepend+:
|
|
371
372
|
|
|
372
373
|
posts.select(:stamp).select_append(:name)
|
|
373
374
|
# SELECT stamp, name FROM posts
|
|
375
|
+
posts.select(:stamp).select_prepend(:name)
|
|
376
|
+
# SELECT name, stamp FROM posts
|
|
374
377
|
|
|
375
378
|
=== Deleting Records
|
|
376
379
|
|
|
@@ -410,9 +413,9 @@ As with +delete+, +update+ affects all rows in the dataset, so +where+ first,
|
|
|
410
413
|
+update+ second:
|
|
411
414
|
|
|
412
415
|
# DO THIS:
|
|
413
|
-
posts.where(Sequel[:stamp] < Date.today - 7).update(:
|
|
416
|
+
posts.where(Sequel[:stamp] < Date.today - 7).update(state: 'archived')
|
|
414
417
|
# NOT THIS:
|
|
415
|
-
posts.update(:
|
|
418
|
+
posts.update(state: 'archived').where(Sequel[:stamp] < Date.today - 7)
|
|
416
419
|
|
|
417
420
|
=== Merging records
|
|
418
421
|
|
|
@@ -447,7 +450,7 @@ You can wrap a block of code in a database transaction using the <tt>Database#tr
|
|
|
447
450
|
# BEGIN
|
|
448
451
|
posts.insert(category: 'ruby', author: 'david')
|
|
449
452
|
# INSERT
|
|
450
|
-
posts.where(Sequel[:stamp] < Date.today - 7).update(:
|
|
453
|
+
posts.where(Sequel[:stamp] < Date.today - 7).update(state: 'archived')
|
|
451
454
|
# UPDATE
|
|
452
455
|
end
|
|
453
456
|
# COMMIT
|
|
@@ -460,9 +463,9 @@ and not raise an exception outside the block, you can raise the
|
|
|
460
463
|
|
|
461
464
|
DB.transaction do
|
|
462
465
|
# BEGIN
|
|
463
|
-
posts.insert(:
|
|
466
|
+
posts.insert(category: 'ruby', author: 'david')
|
|
464
467
|
# INSERT
|
|
465
|
-
if posts.where('stamp < ?', Date.today - 7).update(:
|
|
468
|
+
if posts.where('stamp < ?', Date.today - 7).update(state: 'archived') == 0
|
|
466
469
|
# UPDATE
|
|
467
470
|
raise Sequel::Rollback
|
|
468
471
|
end
|
|
@@ -705,8 +708,8 @@ You can delete individual records by calling +delete+ or +destroy+. The only dif
|
|
|
705
708
|
|
|
706
709
|
Records can also be deleted en-masse by calling <tt>delete</tt> and <tt>destroy</tt> on the model's dataset. As stated above, you can specify filters for the deleted records:
|
|
707
710
|
|
|
708
|
-
Post.where(:
|
|
709
|
-
Post.where(:
|
|
711
|
+
Post.where(category: 32).delete # => bypasses hooks
|
|
712
|
+
Post.where(category: 32).destroy # => runs hooks
|
|
710
713
|
|
|
711
714
|
Please note that if <tt>destroy</tt> is called, each record is deleted
|
|
712
715
|
separately, but <tt>delete</tt> deletes all matching records with a single
|
|
@@ -719,9 +722,9 @@ Associations are used in order to specify relationships between model classes th
|
|
|
719
722
|
class Post < Sequel::Model
|
|
720
723
|
many_to_one :author
|
|
721
724
|
one_to_many :comments
|
|
722
|
-
one_to_one :first_comment, :
|
|
725
|
+
one_to_one :first_comment, class: :Comment, order: :id
|
|
723
726
|
many_to_many :tags
|
|
724
|
-
one_through_one :first_tag, :
|
|
727
|
+
one_through_one :first_tag, class: :Tag, order: :name, right_key: :tag_id
|
|
725
728
|
end
|
|
726
729
|
|
|
727
730
|
+many_to_one+ and +one_to_one+ create a getter and setter for each model object:
|
|
@@ -760,7 +763,7 @@ All associations add a dataset method that can be used to further filter or reor
|
|
|
760
763
|
Associations can be eagerly loaded via +eager+ and the <tt>:eager</tt> association option. Eager loading is used when loading a group of objects. It loads all associated objects for all of the current objects in one query, instead of using a separate query to get the associated objects for each current object. Eager loading requires that you retrieve all model objects at once via +all+ (instead of individually by +each+). Eager loading can be cascaded, loading association's associated objects.
|
|
761
764
|
|
|
762
765
|
class Person < Sequel::Model
|
|
763
|
-
one_to_many :posts, :
|
|
766
|
+
one_to_many :posts, eager: [:tags]
|
|
764
767
|
end
|
|
765
768
|
|
|
766
769
|
class Post < Sequel::Model
|
|
@@ -824,7 +827,7 @@ You can dynamically customize eager loads for both +eager+ and +eager_graph+ whi
|
|
|
824
827
|
|
|
825
828
|
=== Joining with Associations
|
|
826
829
|
|
|
827
|
-
You can use the +association_join+ method to add a join to the model's dataset based on the
|
|
830
|
+
You can use the +association_join+ method to add a join to the model's dataset based on the association:
|
|
828
831
|
|
|
829
832
|
Post.association_join(:author)
|
|
830
833
|
# SELECT * FROM posts
|
|
@@ -926,7 +929,7 @@ Sequel fully supports the currently supported versions of Ruby (MRI) and JRuby.
|
|
|
926
929
|
support unsupported versions of Ruby or JRuby, but such support may be dropped in any
|
|
927
930
|
minor version if keeping it becomes a support issue. The minimum Ruby version
|
|
928
931
|
required to run the current version of Sequel is 1.9.2, and the minimum JRuby version is
|
|
929
|
-
9.
|
|
932
|
+
9.2.0.0 (due to the bigdecimal dependency).
|
|
930
933
|
|
|
931
934
|
== Maintainer
|
|
932
935
|
|
|
@@ -115,7 +115,7 @@ These two approaches can also be nested, with +eager+ -> +eager_graph+ -> +eager
|
|
|
115
115
|
|
|
116
116
|
Or with 2 separate +eager_graph+ queries:
|
|
117
117
|
|
|
118
|
-
Artist.eager_graph(:albums).eager_graph_eager([:albums], :
|
|
118
|
+
Artist.eager_graph(:albums).eager_graph_eager([:albums], tracks: proc{|ds| ds.eager_graph(:lyric)})
|
|
119
119
|
# 2 Queries:
|
|
120
120
|
# SELECT artists.id, artists.name, ...
|
|
121
121
|
# albums.id AS albums_id, albums.name AS albums_name, ...
|
|
@@ -238,9 +238,9 @@ have the following associations
|
|
|
238
238
|
|
|
239
239
|
and the following three albums in the database:
|
|
240
240
|
|
|
241
|
-
album1 = Album.create(:
|
|
242
|
-
album2 = Album.create(:
|
|
243
|
-
album3 = Album.create(:
|
|
241
|
+
album1 = Album.create(artist_id: 3) # id: 1
|
|
242
|
+
album2 = Album.create(artist_id: 3) # id: 2
|
|
243
|
+
album3 = Album.create(artist_id: 2) # id: 3
|
|
244
244
|
|
|
245
245
|
If you try to eager load this dataset:
|
|
246
246
|
|
|
@@ -256,7 +256,7 @@ the are both in the array related to that key. album3 has a different
|
|
|
256
256
|
artist_id, so it is in a different array. Eager loading of artists is
|
|
257
257
|
done by looking for any artist having one of the keys in the hash:
|
|
258
258
|
|
|
259
|
-
artists = Artist.where(:
|
|
259
|
+
artists = Artist.where(id: id_map.keys).all
|
|
260
260
|
|
|
261
261
|
When the artists are retrieved, you can iterate over them, find entries
|
|
262
262
|
with matching keys, and manually associate them to the albums:
|
|
@@ -281,7 +281,7 @@ case each array only has a single object, because id is the primary key). So wh
|
|
|
281
281
|
looking for tracks to eagerly load, you only need to look for ones that have an
|
|
282
282
|
album_id with one of the keys in the hash:
|
|
283
283
|
|
|
284
|
-
tracks = Track.where(:
|
|
284
|
+
tracks = Track.where(album_id: id_map.keys).all
|
|
285
285
|
|
|
286
286
|
When the tracks are retrieved, you can iterate over them, find entries with matching
|
|
287
287
|
keys, and manually associate them to the albums:
|
|
@@ -314,10 +314,10 @@ artist or tracks method on the album will not do another database lookup.
|
|
|
314
314
|
|
|
315
315
|
So putting everything together, the artist eager loader looks like:
|
|
316
316
|
|
|
317
|
-
Album.many_to_one :artist, :
|
|
317
|
+
Album.many_to_one :artist, eager_loader: (proc do |eo_opts|
|
|
318
318
|
eo_opts[:rows].each{|album| album.associations[:artist] = nil}
|
|
319
319
|
id_map = eo_opts[:id_map]
|
|
320
|
-
Artist.where(:
|
|
320
|
+
Artist.where(id: id_map.keys).all do |artist|
|
|
321
321
|
if albums = id_map[artist.id]
|
|
322
322
|
albums.each do |album|
|
|
323
323
|
album.associations[:artist] = artist
|
|
@@ -328,10 +328,10 @@ So putting everything together, the artist eager loader looks like:
|
|
|
328
328
|
|
|
329
329
|
and the tracks eager loader looks like:
|
|
330
330
|
|
|
331
|
-
Album.one_to_many :tracks, :
|
|
331
|
+
Album.one_to_many :tracks, eager_loader: (proc do |eo_opts|
|
|
332
332
|
eo_opts[:rows].each{|album| album.associations[:tracks] = []}
|
|
333
333
|
id_map = eo_opts[:id_map]
|
|
334
|
-
Track.where(:
|
|
334
|
+
Track.where(album_id: id_map.keys).all do |track|
|
|
335
335
|
if albums = id_map[track.album_id]
|
|
336
336
|
albums.each do |album|
|
|
337
337
|
album.associations[:tracks] << track
|
|
@@ -405,7 +405,7 @@ the window function strategy:
|
|
|
405
405
|
|
|
406
406
|
Artist.one_to_many :first_10_albums, class: :Album, order: :release_date, limit: 10,
|
|
407
407
|
eager_limit_strategy: :window_function
|
|
408
|
-
Artist.where(:
|
|
408
|
+
Artist.where(id: [1,2]).eager(:first_10_albums).all
|
|
409
409
|
# SELECT * FROM (
|
|
410
410
|
# SELECT *, row_number() OVER (PARTITION BY albums.artist_id ORDER BY release_date) AS x_sequel_row_number_x
|
|
411
411
|
# FROM albums
|
|
@@ -483,7 +483,7 @@ function:
|
|
|
483
483
|
The :correlated_subquery approach JOINs to a nested subquery using a correlated
|
|
484
484
|
subquery:
|
|
485
485
|
|
|
486
|
-
Artist.eager_graph_with_options(:first_10_albums, :
|
|
486
|
+
Artist.eager_graph_with_options(:first_10_albums, limit_strategy: :correlated_subquery).all
|
|
487
487
|
# SELECT artists.id, artists.name, first_10_albums.id AS first_10_albums_id,
|
|
488
488
|
# first_10_albums.name AS first_10_albums_name, first_10_albums.artist_id,
|
|
489
489
|
# first_10_albums.release_date
|
|
@@ -670,8 +670,10 @@ polymorphic associations in Sequel about as easy as it is in ActiveRecord. Howe
|
|
|
670
670
|
here's how they can be done using Sequel's custom associations (the sequel_polymorphic
|
|
671
671
|
external plugin is just a generic version of this code):
|
|
672
672
|
|
|
673
|
+
Sequel.extension :inflector # for attachable_type.constantize
|
|
674
|
+
|
|
673
675
|
class Asset < Sequel::Model
|
|
674
|
-
many_to_one :attachable, reciprocal: :assets,
|
|
676
|
+
many_to_one :attachable, reciprocal: :assets, reciprocal_type: :one_to_many,
|
|
675
677
|
setter: (lambda do |attachable|
|
|
676
678
|
self[:attachable_id] = (attachable.pk if attachable)
|
|
677
679
|
self[:attachable_type] = (attachable.class.name if attachable)
|
|
@@ -853,7 +855,7 @@ associated tickets.
|
|
|
853
855
|
class Project < Sequel::Model
|
|
854
856
|
one_to_many :tickets
|
|
855
857
|
many_to_one :ticket_hours, read_only: true, key: :id,
|
|
856
|
-
dataset: proc{Ticket.where(:
|
|
858
|
+
dataset: proc{Ticket.where(project_id: id).select{sum(hours).as(hours)}},
|
|
857
859
|
eager_loader: (lambda do |eo|
|
|
858
860
|
eo[:rows].each{|p| p.associations[:ticket_hours] = nil}
|
|
859
861
|
Ticket.where(project_id: eo[:id_map].keys).
|