sequel 5.33.0 → 5.58.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +318 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +40 -9
  5. data/doc/association_basics.rdoc +77 -13
  6. data/doc/cheat_sheet.rdoc +13 -5
  7. data/doc/code_order.rdoc +0 -12
  8. data/doc/dataset_filtering.rdoc +2 -2
  9. data/doc/fork_safety.rdoc +84 -0
  10. data/doc/migration.rdoc +12 -6
  11. data/doc/model_plugins.rdoc +1 -1
  12. data/doc/opening_databases.rdoc +15 -3
  13. data/doc/postgresql.rdoc +9 -1
  14. data/doc/querying.rdoc +7 -5
  15. data/doc/release_notes/5.34.0.txt +40 -0
  16. data/doc/release_notes/5.35.0.txt +56 -0
  17. data/doc/release_notes/5.36.0.txt +60 -0
  18. data/doc/release_notes/5.37.0.txt +30 -0
  19. data/doc/release_notes/5.38.0.txt +28 -0
  20. data/doc/release_notes/5.39.0.txt +19 -0
  21. data/doc/release_notes/5.40.0.txt +40 -0
  22. data/doc/release_notes/5.41.0.txt +25 -0
  23. data/doc/release_notes/5.42.0.txt +136 -0
  24. data/doc/release_notes/5.43.0.txt +98 -0
  25. data/doc/release_notes/5.44.0.txt +32 -0
  26. data/doc/release_notes/5.45.0.txt +34 -0
  27. data/doc/release_notes/5.46.0.txt +87 -0
  28. data/doc/release_notes/5.47.0.txt +59 -0
  29. data/doc/release_notes/5.48.0.txt +14 -0
  30. data/doc/release_notes/5.49.0.txt +59 -0
  31. data/doc/release_notes/5.50.0.txt +78 -0
  32. data/doc/release_notes/5.51.0.txt +47 -0
  33. data/doc/release_notes/5.52.0.txt +87 -0
  34. data/doc/release_notes/5.53.0.txt +23 -0
  35. data/doc/release_notes/5.54.0.txt +27 -0
  36. data/doc/release_notes/5.55.0.txt +21 -0
  37. data/doc/release_notes/5.56.0.txt +51 -0
  38. data/doc/release_notes/5.57.0.txt +23 -0
  39. data/doc/release_notes/5.58.0.txt +31 -0
  40. data/doc/sql.rdoc +14 -2
  41. data/doc/testing.rdoc +10 -1
  42. data/doc/transactions.rdoc +0 -8
  43. data/doc/validations.rdoc +1 -1
  44. data/doc/virtual_rows.rdoc +1 -1
  45. data/lib/sequel/adapters/ado/access.rb +1 -1
  46. data/lib/sequel/adapters/ado.rb +17 -17
  47. data/lib/sequel/adapters/amalgalite.rb +3 -5
  48. data/lib/sequel/adapters/ibmdb.rb +2 -2
  49. data/lib/sequel/adapters/jdbc/derby.rb +8 -0
  50. data/lib/sequel/adapters/jdbc/h2.rb +60 -10
  51. data/lib/sequel/adapters/jdbc/hsqldb.rb +6 -0
  52. data/lib/sequel/adapters/jdbc/mysql.rb +4 -4
  53. data/lib/sequel/adapters/jdbc/postgresql.rb +4 -4
  54. data/lib/sequel/adapters/jdbc.rb +29 -19
  55. data/lib/sequel/adapters/mysql.rb +80 -67
  56. data/lib/sequel/adapters/mysql2.rb +54 -49
  57. data/lib/sequel/adapters/odbc.rb +8 -6
  58. data/lib/sequel/adapters/oracle.rb +5 -4
  59. data/lib/sequel/adapters/postgres.rb +27 -29
  60. data/lib/sequel/adapters/shared/access.rb +2 -0
  61. data/lib/sequel/adapters/shared/db2.rb +30 -0
  62. data/lib/sequel/adapters/shared/mssql.rb +84 -7
  63. data/lib/sequel/adapters/shared/mysql.rb +33 -2
  64. data/lib/sequel/adapters/shared/oracle.rb +82 -7
  65. data/lib/sequel/adapters/shared/postgres.rb +158 -20
  66. data/lib/sequel/adapters/shared/sqlanywhere.rb +3 -0
  67. data/lib/sequel/adapters/shared/sqlite.rb +102 -10
  68. data/lib/sequel/adapters/sqlanywhere.rb +1 -1
  69. data/lib/sequel/adapters/sqlite.rb +60 -18
  70. data/lib/sequel/adapters/tinytds.rb +2 -1
  71. data/lib/sequel/adapters/utils/columns_limit_1.rb +22 -0
  72. data/lib/sequel/adapters/utils/mysql_mysql2.rb +2 -1
  73. data/lib/sequel/ast_transformer.rb +6 -0
  74. data/lib/sequel/connection_pool/sharded_single.rb +9 -8
  75. data/lib/sequel/connection_pool/sharded_threaded.rb +10 -10
  76. data/lib/sequel/connection_pool/single.rb +7 -9
  77. data/lib/sequel/connection_pool/threaded.rb +1 -1
  78. data/lib/sequel/core.rb +33 -24
  79. data/lib/sequel/database/connecting.rb +3 -4
  80. data/lib/sequel/database/misc.rb +37 -12
  81. data/lib/sequel/database/query.rb +3 -1
  82. data/lib/sequel/database/schema_generator.rb +50 -53
  83. data/lib/sequel/database/schema_methods.rb +45 -23
  84. data/lib/sequel/database/transactions.rb +9 -6
  85. data/lib/sequel/dataset/actions.rb +61 -8
  86. data/lib/sequel/dataset/features.rb +15 -0
  87. data/lib/sequel/dataset/placeholder_literalizer.rb +3 -7
  88. data/lib/sequel/dataset/prepared_statements.rb +2 -0
  89. data/lib/sequel/dataset/query.rb +114 -11
  90. data/lib/sequel/dataset/sql.rb +172 -46
  91. data/lib/sequel/deprecated.rb +3 -1
  92. data/lib/sequel/exceptions.rb +2 -0
  93. data/lib/sequel/extensions/_pretty_table.rb +1 -2
  94. data/lib/sequel/extensions/any_not_empty.rb +1 -1
  95. data/lib/sequel/extensions/async_thread_pool.rb +438 -0
  96. data/lib/sequel/extensions/blank.rb +8 -0
  97. data/lib/sequel/extensions/columns_introspection.rb +1 -2
  98. data/lib/sequel/extensions/core_refinements.rb +38 -11
  99. data/lib/sequel/extensions/date_arithmetic.rb +36 -24
  100. data/lib/sequel/extensions/date_parse_input_handler.rb +67 -0
  101. data/lib/sequel/extensions/datetime_parse_to_time.rb +5 -1
  102. data/lib/sequel/extensions/duplicate_columns_handler.rb +3 -1
  103. data/lib/sequel/extensions/eval_inspect.rb +2 -0
  104. data/lib/sequel/extensions/inflector.rb +9 -1
  105. data/lib/sequel/extensions/is_distinct_from.rb +139 -0
  106. data/lib/sequel/extensions/migration.rb +13 -2
  107. data/lib/sequel/extensions/named_timezones.rb +5 -1
  108. data/lib/sequel/extensions/pagination.rb +1 -1
  109. data/lib/sequel/extensions/pg_array.rb +1 -0
  110. data/lib/sequel/extensions/pg_array_ops.rb +6 -2
  111. data/lib/sequel/extensions/pg_enum.rb +3 -1
  112. data/lib/sequel/extensions/pg_extended_date_support.rb +2 -2
  113. data/lib/sequel/extensions/pg_hstore.rb +1 -1
  114. data/lib/sequel/extensions/pg_hstore_ops.rb +55 -3
  115. data/lib/sequel/extensions/pg_inet.rb +2 -0
  116. data/lib/sequel/extensions/pg_inet_ops.rb +1 -1
  117. data/lib/sequel/extensions/pg_interval.rb +35 -8
  118. data/lib/sequel/extensions/pg_json.rb +3 -5
  119. data/lib/sequel/extensions/pg_json_ops.rb +119 -4
  120. data/lib/sequel/extensions/pg_loose_count.rb +3 -1
  121. data/lib/sequel/extensions/pg_multirange.rb +372 -0
  122. data/lib/sequel/extensions/pg_range.rb +7 -19
  123. data/lib/sequel/extensions/pg_range_ops.rb +39 -9
  124. data/lib/sequel/extensions/pg_row.rb +1 -1
  125. data/lib/sequel/extensions/pg_row_ops.rb +25 -1
  126. data/lib/sequel/extensions/query.rb +3 -0
  127. data/lib/sequel/extensions/run_transaction_hooks.rb +1 -1
  128. data/lib/sequel/extensions/s.rb +4 -1
  129. data/lib/sequel/extensions/schema_dumper.rb +16 -5
  130. data/lib/sequel/extensions/server_block.rb +8 -12
  131. data/lib/sequel/extensions/sql_comments.rb +110 -3
  132. data/lib/sequel/extensions/sql_log_normalizer.rb +108 -0
  133. data/lib/sequel/extensions/sqlite_json_ops.rb +255 -0
  134. data/lib/sequel/extensions/string_agg.rb +1 -1
  135. data/lib/sequel/extensions/string_date_time.rb +19 -23
  136. data/lib/sequel/extensions/symbol_aref_refinement.rb +2 -0
  137. data/lib/sequel/extensions/symbol_as_refinement.rb +2 -0
  138. data/lib/sequel/extensions/to_dot.rb +9 -3
  139. data/lib/sequel/model/associations.rb +342 -114
  140. data/lib/sequel/model/base.rb +45 -24
  141. data/lib/sequel/model/errors.rb +10 -1
  142. data/lib/sequel/model/inflections.rb +1 -1
  143. data/lib/sequel/model/plugins.rb +8 -3
  144. data/lib/sequel/model.rb +3 -1
  145. data/lib/sequel/plugins/association_pks.rb +60 -18
  146. data/lib/sequel/plugins/association_proxies.rb +3 -0
  147. data/lib/sequel/plugins/async_thread_pool.rb +39 -0
  148. data/lib/sequel/plugins/auto_restrict_eager_graph.rb +62 -0
  149. data/lib/sequel/plugins/auto_validations.rb +39 -5
  150. data/lib/sequel/plugins/auto_validations_constraint_validations_presence_message.rb +68 -0
  151. data/lib/sequel/plugins/blacklist_security.rb +1 -2
  152. data/lib/sequel/plugins/class_table_inheritance.rb +3 -8
  153. data/lib/sequel/plugins/column_encryption.rb +728 -0
  154. data/lib/sequel/plugins/composition.rb +8 -2
  155. data/lib/sequel/plugins/concurrent_eager_loading.rb +174 -0
  156. data/lib/sequel/plugins/constraint_validations.rb +2 -1
  157. data/lib/sequel/plugins/csv_serializer.rb +2 -0
  158. data/lib/sequel/plugins/dataset_associations.rb +4 -1
  159. data/lib/sequel/plugins/dirty.rb +44 -0
  160. data/lib/sequel/plugins/enum.rb +124 -0
  161. data/lib/sequel/plugins/forbid_lazy_load.rb +2 -0
  162. data/lib/sequel/plugins/insert_conflict.rb +4 -0
  163. data/lib/sequel/plugins/instance_specific_default.rb +113 -0
  164. data/lib/sequel/plugins/json_serializer.rb +39 -24
  165. data/lib/sequel/plugins/lazy_attributes.rb +4 -1
  166. data/lib/sequel/plugins/many_through_many.rb +108 -9
  167. data/lib/sequel/plugins/nested_attributes.rb +8 -3
  168. data/lib/sequel/plugins/pg_array_associations.rb +58 -41
  169. data/lib/sequel/plugins/pg_auto_constraint_validations.rb +2 -0
  170. data/lib/sequel/plugins/prepared_statements.rb +15 -12
  171. data/lib/sequel/plugins/prepared_statements_safe.rb +1 -3
  172. data/lib/sequel/plugins/rcte_tree.rb +37 -35
  173. data/lib/sequel/plugins/serialization.rb +9 -3
  174. data/lib/sequel/plugins/serialization_modification_detection.rb +2 -1
  175. data/lib/sequel/plugins/single_table_inheritance.rb +7 -0
  176. data/lib/sequel/plugins/sql_comments.rb +189 -0
  177. data/lib/sequel/plugins/static_cache.rb +1 -1
  178. data/lib/sequel/plugins/string_stripper.rb +1 -1
  179. data/lib/sequel/plugins/subclasses.rb +28 -11
  180. data/lib/sequel/plugins/tactical_eager_loading.rb +8 -2
  181. data/lib/sequel/plugins/timestamps.rb +1 -1
  182. data/lib/sequel/plugins/tree.rb +9 -4
  183. data/lib/sequel/plugins/unused_associations.rb +521 -0
  184. data/lib/sequel/plugins/update_or_create.rb +1 -1
  185. data/lib/sequel/plugins/validation_class_methods.rb +5 -1
  186. data/lib/sequel/plugins/validation_helpers.rb +18 -11
  187. data/lib/sequel/plugins/xml_serializer.rb +1 -1
  188. data/lib/sequel/sql.rb +1 -1
  189. data/lib/sequel/timezones.rb +20 -17
  190. data/lib/sequel/version.rb +1 -1
  191. metadata +93 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b83782f79b268011fa8a7dd3af1f6eefc03a92b58ac7f2cf4f3411ee3a0bc16e
4
- data.tar.gz: '00679a6acd9fef127e040be0ac93666fdf86f6cdf77d9220168e8b7acf13b069'
3
+ metadata.gz: 2f02f6a35677e8af2ea2b164f655cc869213864e5b27f67cdd3e17c7db28c546
4
+ data.tar.gz: ee09f1b4d5b3f4decbf4d4af3b8ae16ef7e488af40011808dac94f8ca05da89f
5
5
  SHA512:
6
- metadata.gz: f3502c155f4bc2a38c799e4e633fdd9267add64b80e35ac9c77d01ade6666d294ccb60e5fe6e438e94bf0b94f16127c7c35da1c37a40272eafd9f025474ec17f
7
- data.tar.gz: fd8fde26b14389192787cd59d91def5a9efd4c1b5a8faa2a53c7da16fd479788516a233242548edf0c7901f9080038e9c1a4b967088e7eef4503c82cb153d628
6
+ metadata.gz: 89efe5f1a7f2c2eedba5ac1cf336adee1abf489278f79413756e70a41e4ba073ea818562aaf176c1f092e7ab9e763693473a0d96edc6782d9da037c759afd05d
7
+ data.tar.gz: 84986009ccb30a7a0fd15a555262631f539b95ef9ec8d74d6ca2a4078bd07c33ffda725092bad5afbc93b27901e67dc6d06ca735481448174ac695ef14b6ee99
data/CHANGELOG CHANGED
@@ -1,3 +1,321 @@
1
+ === 5.58.0 (2022-07-01)
2
+
3
+ * Support :disable_split_materialized Database option on MySQL to work around optimizer bug in MariaDB 10.5+ affecting association tests (jeremyevans)
4
+
5
+ * Add Dataset#merge* methods to support MERGE statement on PostgreSQL 15+, MSSQL, Oracle, DB2, H2, HSQLDB, and Derby (jeremyevans)
6
+
7
+ === 5.57.0 (2022-06-01)
8
+
9
+ * Make Database#create_function on PostgreSQL accept :parallel option (bananarne) (#1870)
10
+
11
+ * Add support for :on_update_current_timestamp column option on MySQL (jeremyevans)
12
+
13
+ * Add is_distinct_from extension with support for the IS DISTINCT FROM operator (jeremyevans)
14
+
15
+ === 5.56.0 (2022-05-01)
16
+
17
+ * Make alter_table add_column/add_foreign_key methods support :index option to create an index on the column (jeremyevans)
18
+
19
+ * Support creation of STRICT tables on SQLite 3.37.0+ via create_table :strict option (jeremyevans)
20
+
21
+ * Add sqlite_json_ops extension for DSL support for JSON functions and operators added in SQLite 3.38.0 (jeremyevans)
22
+
23
+ * Recognize "INTEGER" type same as "integer" type in the schema dumper, helpful on SQLite 3.37.0+ (jeremyevans)
24
+
25
+ === 5.55.0 (2022-04-01)
26
+
27
+ * Support :setup_regexp_function Database option in the sqlite adapter to allow the use of regexps when querying (jeremyevans)
28
+
29
+ * Add auto_restrict_eager_graph plugin for automatically disallow eager_graph with associations needing but lacking graph options (jeremyevans)
30
+
31
+ * Fix placeholder literalizer optimization for dataset aggregate methods on a model dataset (belousovAV) (#1847, #1848)
32
+
33
+ === 5.54.0 (2022-03-01)
34
+
35
+ * Add enum plugin for treating columns as enums in a model (jeremyevans) (#1839)
36
+
37
+ === 5.53.0 (2022-02-01)
38
+
39
+ * Make Dataset#_sql_comment private when using the Database sql_comments extension (jeremyevans)
40
+
41
+ * Fix prepared statements in the mysql2 adapter to reuse native prepared statements (jeremyevans) (#1832)
42
+
43
+ * Support H2 version 2+ in the jdbc/h2 adapter (jeremyevans) (#1817)
44
+
45
+ * Work around active_support breaking subclasses plugin on Ruby <3.1 (jeremyevans) (#1816)
46
+
47
+ * Fix error handling if trying to setup column_encryption plugin without keys (jeremyevans) (#1815)
48
+
49
+ === 5.52.0 (2022-01-01)
50
+
51
+ * Use Class#subclasses if available in the subclasses plugin, instead of a custom Model.subclasses accessor (jeremyevans)
52
+
53
+ * Add Model.descendants and .freeze_descendants to subclasses plugin (jeremyevans)
54
+
55
+ * Avoid use of deprecated Refinement#include on Ruby 3.1+ (jeremyevans)
56
+
57
+ * Add date_parse_input_handler extension for custom handling of input to date parsing methods (jeremyevans)
58
+
59
+ * Make postgres adapter respect Database#default_string_column_size (jeremyevans)
60
+
61
+ * Make pg_interval extension work with ActiveSupport 7.0 (jeremyevans)
62
+
63
+ * Make :ruby_default schema entry for type: :datetime respect Sequel.datetime_class (jeremyevans)
64
+
65
+ * Make alter_table drop_constraint have an effect on MySQL 8.0.19+ (jeremyevans)
66
+
67
+ * Make mysql adapter support ruby-mysql 3 API (jeremyevans) (#1795)
68
+
69
+ * Make mysql adapter no longer use connection's server_version, since it isn't accurate when using the ruby-mysql driver (jeremyevans)
70
+
71
+ * Add sql_comments plugin for automatically including comments on queries generated by model class, instance, and dataset methods (jeremyevans)
72
+
73
+ * Make sql_comments Database extension support Database#with_comments, for automatically including comments for queries executed inside the block (jeremyevans)
74
+
75
+ * Fix sql_comments extension to not modify cached SQL for a dataset (jeremyevans)
76
+
77
+ === 5.51.0 (2021-12-01)
78
+
79
+ * Make eager loading via tactical_eager_loading no longer modify objects who already have a cached value for the association (jeremyevans)
80
+
81
+ * Make association cloning handle cases where clone association sets different :class option than cloned association (jeremyevans)
82
+
83
+ * Make column schema entries on MySQL include an :extra entry for the Extra column in DESCRIBE output (bschmeck) (#1791)
84
+
85
+ * Update mock PostgreSQL adapter to default to PostgreSQL 14 instead of PostgreSQL 9.5 (jeremyevans)
86
+
87
+ * Support Dataset#with_recursive :search and :cycle options on PostgreSQL 14+ for result ordering and cycle detection (jeremyevans)
88
+
89
+ * Avoid method redefined verbose mode warnings in lazy_attributes plugin (jeremyevans)
90
+
91
+ === 5.50.0 (2021-11-01)
92
+
93
+ * Make Migrator :allow_missing_migration_files also allow down migrations where the current database version is greater than the last migration file version (francisconeves97) (#1789)
94
+
95
+ * Fix Model#freeze in composition, serialization, and serialization_modification_detection plugins to return self (jeremyevans) (#1788)
96
+
97
+ * Fix typecasting of lazy columns when using lazy_attributes plugin in model where dataset selects from subquery (jeremyevans)
98
+
99
+ * Add :before_preconnect Database option, for configuring extensions loaded via :preconnect_extensions (MarcPer, jeremyevans) (#1786)
100
+
101
+ * Change Dataset#columns! to use a LIMIT 0 query instead of a LIMIT 1 query (jeremyevans)
102
+
103
+ * Add sql_log_normalizer extension for normalizing logged SQL, helpful for analytics and sensitive data (jeremyevans)
104
+
105
+ * Add support for range_merge, multirange, and unnest, and PGMultiRange#op to pg_range_ops extension (jeremyevans)
106
+
107
+ * Add pg_multirange extension with support for PostgreSQL 14+ multirange types (jeremyevans)
108
+
109
+ === 5.49.0 (2021-10-01)
110
+
111
+ * Switch block_given? usage to defined?(yield) (jeremyevans)
112
+
113
+ * Support table aliases for JOIN USING columns on PostgreSQL 14+ (jeremyevans)
114
+
115
+ * Support calling PostgreSQL procedures without arguments (jeremyevans)
116
+
117
+ * Support hstore subscripts in pg_hstore_ops on PostgreSQL 14+, for updating only part of an hstore value (jeremyevans)
118
+
119
+ * Support JSONB subscripts in pg_json_ops on PostgreSQL 14+, for updating only part of a JSONB value (jeremyevans)
120
+
121
+ * Support SQL::Expression#sequel_ast_transform for custom AST transforms on arbitrary expressions (jeremyevans)
122
+
123
+ * Add Database#create_trigger :replace option on PostgreSQL 14+ for CREATE OR REPLACE TRIGGER (jeremyevans)
124
+
125
+ * Make auto_validations plugin automatically setup no_null_byte validations (jeremyevans)
126
+
127
+ * Add Model#validates_no_null_byte to validation_helpers plugin (jeremyevans)
128
+
129
+ === 5.48.0 (2021-09-01)
130
+
131
+ * Make the unused_associations plugin association reflection tracking work correctly when combining coverage runs (jeremyevans)
132
+
133
+ * Add Database#like_without_collate on MSSQL, to avoid using COLLATE on LIKE arguments, which can significantly improve performance (jeremyevans)
134
+
135
+ * Add Model::Errors#full_message private method for easiest i18n support for errors with multiple attributes (jeremyevans) (#1779)
136
+
137
+ === 5.47.0 (2021-08-01)
138
+
139
+ * Make the unused_associations plugin track access to association reflections to determine whether associations are used (jeremyevans)
140
+
141
+ * Support :db option for join tables in {many,one}_through_many to use a separate query for each join table (jeremyevans)
142
+
143
+ * Support :join_table_db option for many_to_many/one_through_one associations, to use a separate query for the join table (jeremyevans)
144
+
145
+ * Support :allow_eager_graph and :allow_filtering_by association options (jeremyevans)
146
+
147
+ * Add Database#rename_tables on MySQL, for renaming multiple tables in a single call (nick96) (#1774)
148
+
149
+ * Support Dataset#returning on SQLite 3.35+ (jeremyevans)
150
+
151
+ === 5.46.0 (2021-07-01)
152
+
153
+ * Add unused_associations plugin, for determining which associations and association methods are not used (jeremyevans)
154
+
155
+ * Make nil :setter/:adder/:remover/:clearer association options not create related methods (jeremyevans)
156
+
157
+ === 5.45.0 (2021-06-01)
158
+
159
+ * Fix handling of NULL values in boolean columns in the ODBC adapter (jeremyevans) (#1765)
160
+
161
+ * Add auto_validations_constraint_validations_presence_message plugin for auto_validations/constraint_validations presence message integration (jeremyevans)
162
+
163
+ * Support Dataset#with :materialized option on SQLite 3.35+ for [NOT] MATERIALIZED (jeremyevans)
164
+
165
+ * Use ALTER TABLE DROP COLUMN for dropping columns on SQLite 3.35+ (jeremyevans)
166
+
167
+ === 5.44.0 (2021-05-01)
168
+
169
+ * Add concurrent_eager_loading plugin, for eager loading multiple associations concurrently using separate threads (jeremyevans)
170
+
171
+ * Support :weeks as a interval unit in the date_arithmetic extension (jeremyevans) (#1759)
172
+
173
+ * Raise an exception if an interval hash with an unsupported key is passed in the date_arithmetic extension (jeremyevans) (#1759)
174
+
175
+ * Support dropping non-composite unique constraints on SQLite (jeremyevans) (#1755)
176
+
177
+ === 5.43.0 (2021-04-01)
178
+
179
+ * Add column_encryption plugin, for encrypting column values (jeremyevans)
180
+
181
+ === 5.42.0 (2021-03-01)
182
+
183
+ * Make the ado timestamp conversion proc a normal conversion proc that can be overridden similar to other conversion procs (jeremyevans)
184
+
185
+ * Add :reject_nil option to the nested_attributes method, to ignore calls where nil is passed as the associated object data (jeremyevans)
186
+
187
+ * Add async_thread_pool plugin for easier async usage with model classes and support for async destroy, with_pk, and with_pk! methods (jeremyevans)
188
+
189
+ * Add async_thread_pool Database extension for executing queries asynchronously using a thread pool (jeremyevans)
190
+
191
+ * Fix possible thread safety issue in Database#extension that could allow Module#extended to be called twice with the same Database instance (jeremyevans)
192
+
193
+ * Support cases where validations make modifications beyond setting errors in Model#freeze (jeremyevans)
194
+
195
+ * Add Model#to_json_data to the json_serializer plugin, returning a JSON data structure (jeremyevans)
196
+
197
+ === 5.41.0 (2021-02-01)
198
+
199
+ * Have explicit :text option for a String column take priority over :size option on PostgreSQL (jeremyevans) (#1750)
200
+
201
+ * Support a :skip_invalid option in auto_validations plugin for not adding errors to a column that already has an error (jeremyevans)
202
+
203
+ * Support a :skip_invalid option in validation_helpers for not adding an error to a column that already has an error (jeremyevans)
204
+
205
+ * Support :adder, :remover, and :clearer association options that use keyword arguments in Ruby 2.7+ (jeremyevans)
206
+
207
+ * Make pg_interval use the same number of seconds per year and per month as ActiveSupport::Duration when using ActiveSupport 5.1+ (jeremyevans)
208
+
209
+ === 5.40.0 (2021-01-01)
210
+
211
+ * Support UPDATE FROM syntax in SQLite 3.33.0+ (jeremyevans)
212
+
213
+ * Have pg_interval extension work with ActiveSupport 6.1 (jeremyevans)
214
+
215
+ * Have date_arithmetic extension work with ActiveSupport 6.1 (jeremyevans)
216
+
217
+ * Avoid method redefinition warnings in verbose warning mode (jeremyevans)
218
+
219
+ === 5.39.0 (2020-12-01)
220
+
221
+ * Support :clustered option for primary key and unique constraints on Microsoft SQL Server (jeremyevans)
222
+
223
+ * Do not modify the size of binary columns when using set_column_allow_null on Microsoft SQL Server (jeremyevans) (#1736)
224
+
225
+ * Add a fork safety guide with more detail on how to use Sequel with libraries that fork (janko) (#1733)
226
+
227
+ * Make the roots_dataset method in the tree plugin work with queries using joins (jeremyevans) (#1731)
228
+
229
+ * Make Database#tables return partitioned tables on PostgreSQL 10+ (epoberezhny) (#1729, #1730)
230
+
231
+ === 5.38.0 (2020-11-01)
232
+
233
+ * Do not add new Database instances to Sequel::DATABASES if the test connection fails (jeremyevans) (#1727)
234
+
235
+ * Support the newer com.mysql.cj.jdbc.Driver in the jdbc/mysql adapter (jeremyevans)
236
+
237
+ * Do not swallow disconnect errors in Database#create_or_replace_view or Database#create_table* on Oracle (jeremyevans)
238
+
239
+ * Only rescue non-disconnect Sequel::DatabaseErrors in Postgres::Database#server_version (jeremyevans) (#1724)
240
+
241
+ * Make the single_table_inheritance and prepared_statements plugins work if loaded into the same class (jeremyevans) (#1721)
242
+
243
+ === 5.37.0 (2020-10-01)
244
+
245
+ * Recognize more unsigned decimal/float types in the schema dumper (akimd, jeremyevans) (#1720)
246
+
247
+ * Add Postgres::PGRow::{Array,Hash}Row#op to the pg_row_ops extension if the pg_row extension is loaded (jeremyevans)
248
+
249
+ * Add Model#column_previously_was and #column_previously_changed? to the dirty plugin (jeremyevans)
250
+
251
+ * Raise Migrator::Error if attempting to migrate down to a version where there are necessary migration files missing (jeremyevans) (#1716)
252
+
253
+ === 5.36.0 (2020-09-01)
254
+
255
+ * Handle passing keyword arguments through class methods defined via Plugins.def_dataset_method on Ruby 2.7+ (jeremyevans)
256
+
257
+ * Handle passing keyword arguments through when loading plugins on Ruby 2.7+ (jeremyevans)
258
+
259
+ * Handle passing keyword arguments through migrations when defining custom Database methods that accept keywords on Ruby 2.7+ (jeremyevans)
260
+
261
+ * Handle passing keyword arguments through Dataset#query when using the query extension on Ruby 2.7+ (jeremyevans)
262
+
263
+ * Handle passing keyword arguments through the association proxy when using the association_proxies plugin on Ruby 2.7+ (jeremyevans)
264
+
265
+ * Handle passing keyword arguments through the class method to a method defined in dataset_module on Ruby 2.7+ (adam12) (#1713)
266
+
267
+ * Stream result sets in the odbc adapter for better performance and lower memory usage (sparrovv) (#1711)
268
+
269
+ * Add Postgres::JSONBOp#set_lax and #path_*_tz methods to the pg_json_ops extension for new jsonb functions added in PostgreSQL 13 (jeremyevans)
270
+
271
+ * Add Dataset#with_ties on PostgreSQL 13+ and Microsoft SQL Server to include rows with same order as final row (jeremyevans)
272
+
273
+ * Add a :current_schema option to Database#view_exists? (only defined on Oracle) to look in the current schema instead of non-system schemas (jeremyevans) (#1710)
274
+
275
+ * Recognize another disconnect error in the mysql and mysql2 adapters (jeremyevans) (#1706)
276
+
277
+ === 5.35.0 (2020-08-01)
278
+
279
+ * Recognize another disconnect error in the oracle adapter (sterlzbd) (#1705)
280
+
281
+ * Consider all associations with :dataset options as instance-specific associations (jeremyevans)
282
+
283
+ * Make Model.finalize_associations not break with instance-specific associations (jeremyevans)
284
+
285
+ * Make association placeholder loader consider block if instance_specific: false association option is used (jeremyevans)
286
+
287
+ * Copy composite unique constraints when emulating alter table operations on SQLite (jeremyevans) (#1704)
288
+
289
+ * Add instance_specific_default plugin for setting default association :instance_specific value, or warning/raising for cases where it is not specified (jeremyevans)
290
+
291
+ * Make Model.plugin issue deprecation warning if loading plugin with arguments and block if plugin does not accept arguments/block (jeremyevans)
292
+
293
+ * Make validation_class_methods consider all :if, :allow_missing, :allow_nil, and :allow_blank settings, instead of just the first (jeremyevans)
294
+
295
+ * Include hash entries with nil keys in Dataset#to_dot output in to_dot extension (jeremyevans)
296
+
297
+ * Remove unneeded conditionals from plugins and extensions (jeremyevans)
298
+
299
+ * Fix exception class in run_transaction_hooks extension if calling run_after_{commit,rollback}_hooks outside of a transaction (jeremyevans)
300
+
301
+ === 5.34.0 (2020-07-01)
302
+
303
+ * Make eager_graph work correctly if called with no associations (jeremyevans)
304
+
305
+ * Make :ruby eager limit strategy handle cases where there is no limit or offset (jeremyevans)
306
+
307
+ * Do not keep a reference to a Sequel::Database instance that raises an exception during initialization (jeremyevans)
308
+
309
+ * Make Database#pool.all_connections not yield for a single connection pool in disconnected state (jeremyevans)
310
+
311
+ * Raise an exception if trying to disconnect a server that doesn't exist in the sharded connection pools (jeremyevans)
312
+
313
+ * Support :refresh option when calling *_pks getter method in the association_pks plugin (jeremyevans)
314
+
315
+ * Support caching of repeated calls to *_pks getter method in the association_pks plugin using :cache_pks association option (jeremyevans)
316
+
317
+ * Add *_pks_dataset methods for one_to_many and many_to_many associations when using the association_pks plugin (jeremyevans)
318
+
1
319
  === 5.33.0 (2020-06-01)
2
320
 
3
321
  * Support custom join types on a per-association basis when using eager_graph/association_join (jeremyevans)
data/MIT-LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2007-2008 Sharon Rosner
2
- Copyright (c) 2008-2020 Jeremy Evans
2
+ Copyright (c) 2008-2022 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
@@ -17,15 +17,15 @@ toolkit for Ruby.
17
17
 
18
18
  == Resources
19
19
 
20
- Website :: http://sequel.jeremyevans.net
21
- RDoc Documentation :: http://sequel.jeremyevans.net/rdoc
20
+ Website :: https://sequel.jeremyevans.net
21
+ RDoc Documentation :: https://sequel.jeremyevans.net/rdoc
22
22
  Source Code :: https://github.com/jeremyevans/sequel
23
- Bug tracking (GitHub Issues) :: http://github.com/jeremyevans/sequel/issues
24
- Discussion Forum (sequel-talk Google Group) :: http://groups.google.com/group/sequel-talk
25
- IRC Channel (#sequel) :: irc://irc.freenode.net/sequel
23
+ Bug tracking (GitHub Issues) :: https://github.com/jeremyevans/sequel/issues
24
+ Discussion Forum (GitHub Discussions) :: https://github.com/jeremyevans/sequel/discussions
25
+ Alternate Discussion Forum (sequel-talk Google Group) :: http://groups.google.com/group/sequel-talk
26
26
 
27
27
  If you have questions about how to use Sequel, please ask on the
28
- sequel-talk Google Group or IRC. Only use the the bug tracker to report
28
+ sequel-talk Google Group. Only use the the bug tracker to report
29
29
  bugs in Sequel, not to ask for help on using Sequel.
30
30
 
31
31
  To check out the source code:
@@ -172,7 +172,7 @@ Datasets are the primary way records are retrieved and manipulated. They are ge
172
172
  posts = DB.from(:posts)
173
173
  posts = DB[:posts] # same
174
174
 
175
- Datasets will only fetch records when you tell them to. They can be manipulated to filter records, change ordering, join tables, etc.. Datasets are always frozen, and they safe to use by multiple threads concurrently.
175
+ Datasets will only fetch records when you tell them to. They can be manipulated to filter records, change ordering, join tables, etc. Datasets are always frozen, and they are safe to use by multiple threads concurrently.
176
176
 
177
177
  === Retrieving Records
178
178
 
@@ -414,6 +414,31 @@ As with +delete+, +update+ affects all rows in the dataset, so +where+ first,
414
414
  # NOT THIS:
415
415
  posts.update(:state => 'archived').where(Sequel[:stamp] < Date.today - 7)
416
416
 
417
+ === Merging records
418
+
419
+ Merging records using the SQL MERGE statment is done using <tt>merge*</tt> methods.
420
+ You use +merge_using+ to specify the merge source and join conditions.
421
+ You can use +merge_insert+, +merge_delete+, and/or +merge_update+ to set the
422
+ INSERT, DELETE, and UPDATE clauses for the merge. +merge_insert+ takes the same
423
+ arguments as +insert+, and +merge_update+ takes the same arguments as +update+.
424
+ +merge_insert+, +merge_delete+, and +merge_update+ can all be called with blocks,
425
+ to set the conditions for the related INSERT, DELETE, or UPDATE.
426
+
427
+ Finally, after calling all of the other <tt>merge_*</tt> methods, you call +merge+
428
+ to run the MERGE statement on the database.
429
+
430
+ ds = DB[:m1]
431
+ merge_using(:m2, i1: :i2).
432
+ merge_insert(i1: :i2, a: Sequel[:b]+11).
433
+ merge_delete{a > 30}.
434
+ merge_update(i1: Sequel[:i1]+:i2+10, a: Sequel[:a]+:b+20)
435
+
436
+ ds.merge
437
+ # MERGE INTO m1 USING m2 ON (i1 = i2)
438
+ # WHEN NOT MATCHED THEN INSERT (i1, a) VALUES (i2, (b + 11))
439
+ # WHEN MATCHED AND (a > 30) THEN DELETE
440
+ # WHEN MATCHED THEN UPDATE SET i1 = (i1 + i2 + 10), a = (a + b + 20)
441
+
417
442
  === Transactions
418
443
 
419
444
  You can wrap a block of code in a database transaction using the <tt>Database#transaction</tt> method:
@@ -880,10 +905,15 @@ raise an error by default:
880
905
  end
881
906
  end
882
907
 
908
+ == Testing Sequel
909
+
910
+ Please see the {testing guide}[rdoc-ref:doc/testing.rdoc] for recommendations on testing
911
+ applications that use Sequel, as well as the how to run the tests for Sequel itself.
912
+
883
913
  == Sequel Release Policy
884
914
 
885
915
  New major versions of Sequel do not have a defined release policy, but historically have
886
- occurred once ever few years.
916
+ occurred once every few years.
887
917
 
888
918
  New minor versions of Sequel are released around once a month near the start of the month.
889
919
 
@@ -895,7 +925,8 @@ in the most current release.
895
925
  Sequel fully supports the currently supported versions of Ruby (MRI) and JRuby. It may
896
926
  support unsupported versions of Ruby or JRuby, but such support may be dropped in any
897
927
  minor version if keeping it becomes a support issue. The minimum Ruby version
898
- required to run the current version of Sequel is 1.9.2.
928
+ required to run the current version of Sequel is 1.9.2, and the minimum JRuby version is
929
+ 9.0.0.0.
899
930
 
900
931
  == Maintainer
901
932
 
@@ -41,7 +41,7 @@ As is the code to add a related album to an artist:
41
41
 
42
42
  @artist.add_album(name: 'RF')
43
43
 
44
- It also makes it easier to creating queries that use joins based on the association:
44
+ It also makes it easier to create queries that use joins based on the association:
45
45
 
46
46
  Artist.association_join(:albums)
47
47
  # SELECT * FROM artists
@@ -63,8 +63,8 @@ It ships with additional association types via plugins.
63
63
 
64
64
  The many_to_one association is used when the table for the current class
65
65
  contains a foreign key that references the primary key in the table for the
66
- associated class. It is named because there can be many rows in the current
67
- table for each row in the associated table.
66
+ associated class. It is named 'many_to_one' because there can be many rows
67
+ in the current table for each row in the associated table.
68
68
 
69
69
  # Database schema:
70
70
  # albums artists
@@ -81,8 +81,8 @@ table for each row in the associated table.
81
81
 
82
82
  The one_to_many association is used when the table for the associated class
83
83
  contains a foreign key that references the primary key in the table for the
84
- current class. It is named because for each row in the current table there
85
- can be many rows in the associated table:
84
+ current class. It is named 'one_to_many' because for each row in the
85
+ current table there can be many rows in the associated table:
86
86
 
87
87
  The one_to_one association can be thought of as a subset of the one_to_many association,
88
88
  but where there can only be either 0 or 1 records in the associated table. This is
@@ -344,7 +344,7 @@ instance method:
344
344
 
345
345
  == Dataset Method
346
346
 
347
- In addition to the above methods, associations also add a instance method
347
+ In addition to the above methods, associations also add an instance method
348
348
  ending in +_dataset+ that returns a dataset representing the objects in the associated table:
349
349
 
350
350
  @album.artist_id
@@ -826,6 +826,8 @@ you also wanted to handle the Artist#add_album method:
826
826
  end)
827
827
  end
828
828
 
829
+ You can set this to +nil+ to not create a add_<i>association</i> method.
830
+
829
831
  === :remover (\_remove_<i>association</i> method)
830
832
 
831
833
  Continuing with the same example, here's how you would handle the same case if
@@ -837,6 +839,8 @@ you also wanted to handle the Artist#remove_album method:
837
839
  end)
838
840
  end
839
841
 
842
+ You can set this to +nil+ to not create a remove_<i>association</i> method.
843
+
840
844
  === :clearer (\_remove_all_<i>association</i> method)
841
845
 
842
846
  Continuing with the same example, here's how you would handle the same case if
@@ -850,6 +854,22 @@ you also wanted to handle the Artist#remove_all_albums method:
850
854
  end)
851
855
  end
852
856
 
857
+ You can set this to +nil+ to not create a remove_all_<i>association</i> method.
858
+
859
+ === :no_dataset_method
860
+
861
+ Setting this to true will not result in the <i>association</i>_dataset method
862
+ not being defined. This can save memory if you only use the <i>association</i>
863
+ method and do not call the <i>association</i>_dataset method directly or
864
+ indirectly.
865
+
866
+ === :no_association_method
867
+
868
+ Setting this to true will not result in the <i>association</i> method
869
+ not being defined. This can save memory if you only use the
870
+ <i>association</i>_dataset method and do not call the <i>association</i> method
871
+ directly or indirectly.
872
+
853
873
  == Association Options
854
874
 
855
875
  Sequel's associations mostly share the same options. For ease of understanding,
@@ -1087,7 +1107,7 @@ already applied, and the proc should return a modified copy of this dataset.
1087
1107
  Here's an example of an association of songs to artists through lyrics, where
1088
1108
  the artist can perform any one of four tasks for the lyric:
1089
1109
 
1090
- Album.one_to_many :songs, dataset: (lambda do |r|
1110
+ Artist.one_to_many :songs, dataset: (lambda do |r|
1091
1111
  r.associated_dataset.select_all(:songs).
1092
1112
  join(:lyrics, id: :lyricid, id=>[:composer_id, :arranger_id, :vocalist_id, :lyricist_id])
1093
1113
  end)
@@ -1146,6 +1166,23 @@ when deleting.
1146
1166
  ds.where(instrument_id: 5)
1147
1167
  end)
1148
1168
 
1169
+ ==== :join_table_db [+many_to_many+, +one_through_one+]
1170
+
1171
+ A Sequel::Database to use for the join table. Specifying this option switches the
1172
+ loading to use a separate query for the join table. This is useful if the
1173
+ join table is not located in the same database as the associated table, or
1174
+ if the database account with access to the associated table doesn't have
1175
+ access to the join table.
1176
+
1177
+ For example, if the Album class uses a different Sequel::Database than the Artist
1178
+ class, and the join table is in the database that the Artist class uses:
1179
+
1180
+ Artist.many_to_many :lead_guitar_albums, class: :Album, :join_table_db=>Artist.db
1181
+
1182
+ This option also affects the add/remove/remove_all methods, by changing
1183
+ which database is used for inserts/deletes from the join table (add/remove/remove_all
1184
+ defaults to use the current model's database instead of the associated model's database).
1185
+
1149
1186
  === Callback Options
1150
1187
 
1151
1188
  All callbacks can be specified as a Symbol, Proc, or array of both/either
@@ -1638,9 +1675,8 @@ For +many_to_one+ and +one_to_one+ associations, do not add a setter method.
1638
1675
  For +one_to_many+ and +many_to_many+, do not add the add_<i>association</i>,
1639
1676
  remove_<i>association</i>, or remove_all_<i>association</i> methods.
1640
1677
 
1641
- If the default modification methods would not do what you want, and you
1642
- don't plan on overriding the internal modification methods to do what you
1643
- want, it may be best to set this option to true.
1678
+ If you are not using the association modification methods, setting this
1679
+ value to true will save memory.
1644
1680
 
1645
1681
  ==== :validate
1646
1682
 
@@ -1667,20 +1703,48 @@ If set to false, you cannot load the association eagerly via eager or
1667
1703
  eager_graph.
1668
1704
 
1669
1705
  Artist.one_to_many :albums, allow_eager: false
1670
- Artist.eager(:albums) # Raises Sequel::Error
1706
+ Artist.eager(:albums) # Raises Sequel::Error
1707
+ Artist.eager_graph(:albums) # Raises Sequel::Error
1671
1708
 
1672
1709
  This is usually used if the association dataset depends on specific values in
1673
1710
  model instance that would not be valid when eager loading for multiple
1674
1711
  instances.
1675
1712
 
1713
+ ==== :allow_eager_graph
1714
+
1715
+ If set to false, you cannot load the association eagerly via eager_graph.
1716
+
1717
+ Artist.one_to_many :albums, allow_eager_graph: false
1718
+ Artist.eager(:albums) # Allowed
1719
+ Artist.eager_graph(:albums) # Raises Sequel::Error
1720
+
1721
+ This is useful if you still want to allow loading via eager, but do not want
1722
+ to allow loading via eager graph, possibly because the association does not
1723
+ support joins.
1724
+
1725
+ ==== :allow_filtering_by
1726
+
1727
+ If set to false, you cannot use the association when filtering.
1728
+
1729
+ Artist.one_to_many :albums, allow_filtering_by: false
1730
+ Artist.where(:albums=>Album.where(:name=>'A')).all # Raises Sequel::Error
1731
+
1732
+ This is useful if such filtering cannot work, such as when a subquery cannot
1733
+ be used because the necessary tables are not in the same database.
1734
+
1676
1735
  ==== :instance_specific
1677
1736
 
1678
1737
  This allows you to override the setting of whether the dataset contains instance
1679
- specific code. For example, if you are passing a block to the association,
1738
+ specific code. If you are passing a block to the association,
1680
1739
  Sequel sets this to true by default, which disables some optimizations that
1681
1740
  would be invalid if the association is instance specific. If you know that the
1682
1741
  block does not contain instance specific code, you can set this to false to
1683
- reenable the optimizations.
1742
+ reenable the optimizations. Instance specific code is mostly commonly calling
1743
+ model instance methods inside an association block, but also
1744
+ includes cases where the association block can return different values based
1745
+ on the runtime environment, such as calls to <tt>Time.now</tt> in the block.
1746
+ Associations that use the :dataset option are always considered instance specific,
1747
+ even if explicitly specified otherwise.
1684
1748
 
1685
1749
  ==== :cartesian_product_number
1686
1750
 
data/doc/cheat_sheet.rdoc CHANGED
@@ -57,6 +57,14 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
57
57
  dataset.where{price < 100}.update(:active => true)
58
58
  dataset.where(:active).update(:price => Sequel[:price] * 0.90)
59
59
 
60
+ = Merge rows
61
+
62
+ dataset.
63
+ merge_using(:table, col1: :col2).
64
+ merge_insert(col3: :col4).
65
+ merge_delete{col5 > 30}.
66
+ merge_update(col3: Sequel[:col3] + :col4)
67
+
60
68
  == Datasets are Enumerable
61
69
 
62
70
  dataset.map{|r| r[:name]}
@@ -95,18 +103,18 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
95
103
 
96
104
  === AND/OR/NOT
97
105
 
98
- DB[:items].where{(x > 5) & (y > 10)}.sql
106
+ DB[:items].where{(x > 5) & (y > 10)}
99
107
  # SELECT * FROM items WHERE ((x > 5) AND (y > 10))
100
108
 
101
- DB[:items].where(Sequel.or(x: 1, y: 2) & Sequel.~(z: 3)).sql
109
+ DB[:items].where(Sequel.or(x: 1, y: 2) & Sequel.~(z: 3))
102
110
  # SELECT * FROM items WHERE (((x = 1) OR (y = 2)) AND (z != 3))
103
111
 
104
112
  === Mathematical operators
105
113
 
106
- DB[:items].where{x + y > z}.sql
114
+ DB[:items].where{x + y > z}
107
115
  # SELECT * FROM items WHERE ((x + y) > z)
108
116
 
109
- DB[:items].where{price - 100 < avg(price)}.sql
117
+ DB[:items].where{price - 100 < avg(price)}
110
118
  # SELECT * FROM items WHERE ((price - 100) < avg(price))
111
119
 
112
120
  === Raw SQL Fragments
@@ -130,7 +138,7 @@ Without a filename argument, the sqlite adapter will setup a new sqlite database
130
138
 
131
139
  == Joins
132
140
 
133
- DB[:items].left_outer_join(:categories, id: :category_id).sql
141
+ DB[:items].left_outer_join(:categories, id: :category_id)
134
142
  # SELECT * FROM items
135
143
  # LEFT OUTER JOIN categories ON categories.id = items.category_id
136
144
 
data/doc/code_order.rdoc CHANGED
@@ -100,15 +100,3 @@ and freezing them can easily be achieved through the plugin:
100
100
  # ... setup models
101
101
  # Now finalize associations & freeze models by calling the plugin:
102
102
  Sequel::Model.freeze_descendents
103
-
104
- == Disconnect If Using Forking Webserver with Code Preloading
105
-
106
- If you are using a forking webserver such as unicorn or passenger, with
107
- a feature that loads your Sequel code before forking connections (code
108
- preloading), then you must disconnect your database connections before
109
- forking. If you don't do this, you can end up with child processes
110
- sharing database connections and all sorts of weird behavior. Sequel
111
- will automatically reconnect on an as needed basis in the child
112
- processes, so you only need to do the following in the parent process:
113
-
114
- DB.disconnect