sequel 5.29.0 → 5.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (387) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +70 -1922
  3. data/README.rdoc +1 -1
  4. data/doc/advanced_associations.rdoc +4 -4
  5. data/doc/association_basics.rdoc +3 -3
  6. data/doc/code_order.rdoc +12 -2
  7. data/doc/model_dataset_method_design.rdoc +1 -1
  8. data/doc/postgresql.rdoc +71 -0
  9. data/doc/release_notes/5.30.0.txt +20 -0
  10. data/doc/release_notes/5.31.0.txt +148 -0
  11. data/doc/release_notes/5.32.0.txt +46 -0
  12. data/doc/release_notes/5.33.0.txt +24 -0
  13. data/doc/release_notes/5.34.0.txt +40 -0
  14. data/doc/testing.rdoc +1 -1
  15. data/lib/sequel/adapters/shared/access.rb +6 -6
  16. data/lib/sequel/adapters/shared/mssql.rb +5 -5
  17. data/lib/sequel/adapters/shared/mysql.rb +9 -9
  18. data/lib/sequel/adapters/shared/oracle.rb +16 -16
  19. data/lib/sequel/adapters/shared/postgres.rb +169 -14
  20. data/lib/sequel/adapters/shared/sqlanywhere.rb +9 -9
  21. data/lib/sequel/adapters/shared/sqlite.rb +32 -5
  22. data/lib/sequel/connection_pool/sharded_single.rb +4 -1
  23. data/lib/sequel/connection_pool/sharded_threaded.rb +12 -12
  24. data/lib/sequel/connection_pool/single.rb +1 -1
  25. data/lib/sequel/connection_pool/threaded.rb +2 -2
  26. data/lib/sequel/core.rb +318 -314
  27. data/lib/sequel/database/connecting.rb +1 -1
  28. data/lib/sequel/database/misc.rb +16 -10
  29. data/lib/sequel/database/query.rb +3 -1
  30. data/lib/sequel/database/schema_generator.rb +0 -1
  31. data/lib/sequel/database/schema_methods.rb +15 -16
  32. data/lib/sequel/database/transactions.rb +12 -13
  33. data/lib/sequel/dataset/placeholder_literalizer.rb +3 -7
  34. data/lib/sequel/dataset/query.rb +4 -3
  35. data/lib/sequel/deprecated.rb +2 -0
  36. data/lib/sequel/exceptions.rb +2 -0
  37. data/lib/sequel/extensions/connection_expiration.rb +2 -2
  38. data/lib/sequel/extensions/connection_validator.rb +2 -2
  39. data/lib/sequel/extensions/fiber_concurrency.rb +24 -0
  40. data/lib/sequel/extensions/index_caching.rb +9 -7
  41. data/lib/sequel/extensions/integer64.rb +2 -0
  42. data/lib/sequel/extensions/migration.rb +1 -1
  43. data/lib/sequel/extensions/pg_enum.rb +5 -2
  44. data/lib/sequel/extensions/pg_hstore.rb +6 -0
  45. data/lib/sequel/extensions/pg_inet.rb +13 -5
  46. data/lib/sequel/extensions/pg_interval.rb +2 -0
  47. data/lib/sequel/extensions/pg_range.rb +2 -0
  48. data/lib/sequel/extensions/pg_timestamptz.rb +2 -0
  49. data/lib/sequel/extensions/run_transaction_hooks.rb +72 -0
  50. data/lib/sequel/extensions/schema_dumper.rb +10 -4
  51. data/lib/sequel/extensions/server_block.rb +3 -3
  52. data/lib/sequel/model.rb +2 -0
  53. data/lib/sequel/model/associations.rb +30 -18
  54. data/lib/sequel/model/base.rb +64 -55
  55. data/lib/sequel/model/plugins.rb +3 -3
  56. data/lib/sequel/plugins/association_lazy_eager_option.rb +66 -0
  57. data/lib/sequel/plugins/association_multi_add_remove.rb +2 -0
  58. data/lib/sequel/plugins/association_pks.rb +57 -16
  59. data/lib/sequel/plugins/association_proxies.rb +2 -0
  60. data/lib/sequel/plugins/boolean_subsets.rb +4 -1
  61. data/lib/sequel/plugins/class_table_inheritance.rb +26 -26
  62. data/lib/sequel/plugins/dirty.rb +13 -13
  63. data/lib/sequel/plugins/forbid_lazy_load.rb +214 -0
  64. data/lib/sequel/plugins/json_serializer.rb +3 -7
  65. data/lib/sequel/plugins/rcte_tree.rb +2 -2
  66. data/lib/sequel/plugins/single_table_inheritance.rb +15 -15
  67. data/lib/sequel/plugins/skip_saving_columns.rb +108 -0
  68. data/lib/sequel/plugins/subclasses.rb +2 -0
  69. data/lib/sequel/timezones.rb +6 -4
  70. data/lib/sequel/version.rb +1 -1
  71. metadata +17 -368
  72. data/Rakefile +0 -151
  73. data/doc/release_notes/4.0.0.txt +0 -262
  74. data/doc/release_notes/4.1.0.txt +0 -85
  75. data/doc/release_notes/4.10.0.txt +0 -226
  76. data/doc/release_notes/4.11.0.txt +0 -147
  77. data/doc/release_notes/4.12.0.txt +0 -105
  78. data/doc/release_notes/4.13.0.txt +0 -169
  79. data/doc/release_notes/4.14.0.txt +0 -68
  80. data/doc/release_notes/4.15.0.txt +0 -56
  81. data/doc/release_notes/4.16.0.txt +0 -36
  82. data/doc/release_notes/4.17.0.txt +0 -38
  83. data/doc/release_notes/4.18.0.txt +0 -36
  84. data/doc/release_notes/4.19.0.txt +0 -45
  85. data/doc/release_notes/4.2.0.txt +0 -129
  86. data/doc/release_notes/4.20.0.txt +0 -79
  87. data/doc/release_notes/4.21.0.txt +0 -94
  88. data/doc/release_notes/4.22.0.txt +0 -72
  89. data/doc/release_notes/4.23.0.txt +0 -65
  90. data/doc/release_notes/4.24.0.txt +0 -99
  91. data/doc/release_notes/4.25.0.txt +0 -181
  92. data/doc/release_notes/4.26.0.txt +0 -44
  93. data/doc/release_notes/4.27.0.txt +0 -78
  94. data/doc/release_notes/4.28.0.txt +0 -57
  95. data/doc/release_notes/4.29.0.txt +0 -41
  96. data/doc/release_notes/4.3.0.txt +0 -40
  97. data/doc/release_notes/4.30.0.txt +0 -37
  98. data/doc/release_notes/4.31.0.txt +0 -57
  99. data/doc/release_notes/4.32.0.txt +0 -132
  100. data/doc/release_notes/4.33.0.txt +0 -88
  101. data/doc/release_notes/4.34.0.txt +0 -86
  102. data/doc/release_notes/4.35.0.txt +0 -130
  103. data/doc/release_notes/4.36.0.txt +0 -116
  104. data/doc/release_notes/4.37.0.txt +0 -50
  105. data/doc/release_notes/4.38.0.txt +0 -67
  106. data/doc/release_notes/4.39.0.txt +0 -127
  107. data/doc/release_notes/4.4.0.txt +0 -92
  108. data/doc/release_notes/4.40.0.txt +0 -179
  109. data/doc/release_notes/4.41.0.txt +0 -77
  110. data/doc/release_notes/4.42.0.txt +0 -221
  111. data/doc/release_notes/4.43.0.txt +0 -87
  112. data/doc/release_notes/4.44.0.txt +0 -125
  113. data/doc/release_notes/4.45.0.txt +0 -370
  114. data/doc/release_notes/4.46.0.txt +0 -404
  115. data/doc/release_notes/4.47.0.txt +0 -56
  116. data/doc/release_notes/4.48.0.txt +0 -293
  117. data/doc/release_notes/4.49.0.txt +0 -222
  118. data/doc/release_notes/4.5.0.txt +0 -34
  119. data/doc/release_notes/4.6.0.txt +0 -30
  120. data/doc/release_notes/4.7.0.txt +0 -103
  121. data/doc/release_notes/4.8.0.txt +0 -175
  122. data/doc/release_notes/4.9.0.txt +0 -190
  123. data/spec/adapter_spec.rb +0 -4
  124. data/spec/adapters/db2_spec.rb +0 -170
  125. data/spec/adapters/mssql_spec.rb +0 -828
  126. data/spec/adapters/mysql_spec.rb +0 -1060
  127. data/spec/adapters/oracle_spec.rb +0 -371
  128. data/spec/adapters/postgres_spec.rb +0 -4476
  129. data/spec/adapters/spec_helper.rb +0 -44
  130. data/spec/adapters/sqlanywhere_spec.rb +0 -97
  131. data/spec/adapters/sqlite_spec.rb +0 -652
  132. data/spec/bin_spec.rb +0 -278
  133. data/spec/core/connection_pool_spec.rb +0 -1250
  134. data/spec/core/database_spec.rb +0 -2915
  135. data/spec/core/dataset_spec.rb +0 -5544
  136. data/spec/core/deprecated_spec.rb +0 -70
  137. data/spec/core/expression_filters_spec.rb +0 -1498
  138. data/spec/core/mock_adapter_spec.rb +0 -722
  139. data/spec/core/object_graph_spec.rb +0 -336
  140. data/spec/core/placeholder_literalizer_spec.rb +0 -166
  141. data/spec/core/schema_generator_spec.rb +0 -214
  142. data/spec/core/schema_spec.rb +0 -1844
  143. data/spec/core/spec_helper.rb +0 -24
  144. data/spec/core/version_spec.rb +0 -14
  145. data/spec/core_extensions_spec.rb +0 -763
  146. data/spec/core_model_spec.rb +0 -2
  147. data/spec/core_spec.rb +0 -1
  148. data/spec/deprecation_helper.rb +0 -30
  149. data/spec/extensions/accessed_columns_spec.rb +0 -51
  150. data/spec/extensions/active_model_spec.rb +0 -99
  151. data/spec/extensions/after_initialize_spec.rb +0 -28
  152. data/spec/extensions/any_not_empty_spec.rb +0 -23
  153. data/spec/extensions/arbitrary_servers_spec.rb +0 -109
  154. data/spec/extensions/association_dependencies_spec.rb +0 -125
  155. data/spec/extensions/association_multi_add_remove_spec.rb +0 -1041
  156. data/spec/extensions/association_pks_spec.rb +0 -423
  157. data/spec/extensions/association_proxies_spec.rb +0 -100
  158. data/spec/extensions/auto_literal_strings_spec.rb +0 -205
  159. data/spec/extensions/auto_validations_spec.rb +0 -229
  160. data/spec/extensions/blacklist_security_spec.rb +0 -95
  161. data/spec/extensions/blank_spec.rb +0 -69
  162. data/spec/extensions/boolean_readers_spec.rb +0 -93
  163. data/spec/extensions/boolean_subsets_spec.rb +0 -47
  164. data/spec/extensions/caching_spec.rb +0 -273
  165. data/spec/extensions/caller_logging_spec.rb +0 -52
  166. data/spec/extensions/class_table_inheritance_spec.rb +0 -750
  167. data/spec/extensions/column_conflicts_spec.rb +0 -75
  168. data/spec/extensions/column_select_spec.rb +0 -129
  169. data/spec/extensions/columns_introspection_spec.rb +0 -90
  170. data/spec/extensions/columns_updated_spec.rb +0 -35
  171. data/spec/extensions/composition_spec.rb +0 -248
  172. data/spec/extensions/connection_expiration_spec.rb +0 -151
  173. data/spec/extensions/connection_validator_spec.rb +0 -144
  174. data/spec/extensions/constant_sql_override_spec.rb +0 -24
  175. data/spec/extensions/constraint_validations_plugin_spec.rb +0 -300
  176. data/spec/extensions/constraint_validations_spec.rb +0 -439
  177. data/spec/extensions/core_refinements_spec.rb +0 -528
  178. data/spec/extensions/csv_serializer_spec.rb +0 -183
  179. data/spec/extensions/current_datetime_timestamp_spec.rb +0 -27
  180. data/spec/extensions/dataset_associations_spec.rb +0 -365
  181. data/spec/extensions/dataset_source_alias_spec.rb +0 -51
  182. data/spec/extensions/date_arithmetic_spec.rb +0 -181
  183. data/spec/extensions/datetime_parse_to_time_spec.rb +0 -169
  184. data/spec/extensions/def_dataset_method_spec.rb +0 -100
  185. data/spec/extensions/defaults_setter_spec.rb +0 -150
  186. data/spec/extensions/delay_add_association_spec.rb +0 -73
  187. data/spec/extensions/dirty_spec.rb +0 -222
  188. data/spec/extensions/duplicate_columns_handler_spec.rb +0 -104
  189. data/spec/extensions/eager_each_spec.rb +0 -62
  190. data/spec/extensions/eager_graph_eager_spec.rb +0 -100
  191. data/spec/extensions/empty_array_consider_nulls_spec.rb +0 -24
  192. data/spec/extensions/empty_failure_backtraces_spec.rb +0 -60
  193. data/spec/extensions/error_splitter_spec.rb +0 -18
  194. data/spec/extensions/error_sql_spec.rb +0 -20
  195. data/spec/extensions/escaped_like_spec.rb +0 -40
  196. data/spec/extensions/eval_inspect_spec.rb +0 -81
  197. data/spec/extensions/exclude_or_null_spec.rb +0 -15
  198. data/spec/extensions/finder_spec.rb +0 -260
  199. data/spec/extensions/force_encoding_spec.rb +0 -126
  200. data/spec/extensions/freeze_datasets_spec.rb +0 -31
  201. data/spec/extensions/graph_each_spec.rb +0 -113
  202. data/spec/extensions/hook_class_methods_spec.rb +0 -402
  203. data/spec/extensions/identifier_mangling_spec.rb +0 -201
  204. data/spec/extensions/implicit_subquery_spec.rb +0 -58
  205. data/spec/extensions/index_caching_spec.rb +0 -66
  206. data/spec/extensions/inflector_spec.rb +0 -183
  207. data/spec/extensions/input_transformer_spec.rb +0 -69
  208. data/spec/extensions/insert_conflict_spec.rb +0 -103
  209. data/spec/extensions/insert_returning_select_spec.rb +0 -72
  210. data/spec/extensions/instance_filters_spec.rb +0 -79
  211. data/spec/extensions/instance_hooks_spec.rb +0 -246
  212. data/spec/extensions/integer64_spec.rb +0 -22
  213. data/spec/extensions/inverted_subsets_spec.rb +0 -33
  214. data/spec/extensions/json_serializer_spec.rb +0 -346
  215. data/spec/extensions/lazy_attributes_spec.rb +0 -183
  216. data/spec/extensions/list_spec.rb +0 -291
  217. data/spec/extensions/looser_typecasting_spec.rb +0 -43
  218. data/spec/extensions/many_through_many_spec.rb +0 -2177
  219. data/spec/extensions/migration_spec.rb +0 -864
  220. data/spec/extensions/modification_detection_spec.rb +0 -93
  221. data/spec/extensions/mssql_optimistic_locking_spec.rb +0 -92
  222. data/spec/extensions/named_timezones_spec.rb +0 -218
  223. data/spec/extensions/nested_attributes_spec.rb +0 -815
  224. data/spec/extensions/null_dataset_spec.rb +0 -85
  225. data/spec/extensions/optimistic_locking_spec.rb +0 -127
  226. data/spec/extensions/pagination_spec.rb +0 -116
  227. data/spec/extensions/pg_array_associations_spec.rb +0 -802
  228. data/spec/extensions/pg_array_ops_spec.rb +0 -144
  229. data/spec/extensions/pg_array_spec.rb +0 -398
  230. data/spec/extensions/pg_auto_constraint_validations_spec.rb +0 -209
  231. data/spec/extensions/pg_enum_spec.rb +0 -118
  232. data/spec/extensions/pg_extended_date_support_spec.rb +0 -126
  233. data/spec/extensions/pg_hstore_ops_spec.rb +0 -238
  234. data/spec/extensions/pg_hstore_spec.rb +0 -219
  235. data/spec/extensions/pg_inet_ops_spec.rb +0 -102
  236. data/spec/extensions/pg_inet_spec.rb +0 -72
  237. data/spec/extensions/pg_interval_spec.rb +0 -103
  238. data/spec/extensions/pg_json_ops_spec.rb +0 -356
  239. data/spec/extensions/pg_json_spec.rb +0 -451
  240. data/spec/extensions/pg_loose_count_spec.rb +0 -23
  241. data/spec/extensions/pg_range_ops_spec.rb +0 -60
  242. data/spec/extensions/pg_range_spec.rb +0 -600
  243. data/spec/extensions/pg_row_ops_spec.rb +0 -61
  244. data/spec/extensions/pg_row_plugin_spec.rb +0 -60
  245. data/spec/extensions/pg_row_spec.rb +0 -363
  246. data/spec/extensions/pg_static_cache_updater_spec.rb +0 -93
  247. data/spec/extensions/pg_timestamptz_spec.rb +0 -17
  248. data/spec/extensions/prepared_statements_safe_spec.rb +0 -66
  249. data/spec/extensions/prepared_statements_spec.rb +0 -177
  250. data/spec/extensions/pretty_table_spec.rb +0 -123
  251. data/spec/extensions/query_spec.rb +0 -94
  252. data/spec/extensions/rcte_tree_spec.rb +0 -387
  253. data/spec/extensions/round_timestamps_spec.rb +0 -39
  254. data/spec/extensions/s_spec.rb +0 -60
  255. data/spec/extensions/schema_caching_spec.rb +0 -64
  256. data/spec/extensions/schema_dumper_spec.rb +0 -870
  257. data/spec/extensions/select_remove_spec.rb +0 -38
  258. data/spec/extensions/sequel_4_dataset_methods_spec.rb +0 -121
  259. data/spec/extensions/serialization_modification_detection_spec.rb +0 -98
  260. data/spec/extensions/serialization_spec.rb +0 -365
  261. data/spec/extensions/server_block_spec.rb +0 -135
  262. data/spec/extensions/server_logging_spec.rb +0 -45
  263. data/spec/extensions/sharding_spec.rb +0 -197
  264. data/spec/extensions/shared_caching_spec.rb +0 -151
  265. data/spec/extensions/single_table_inheritance_spec.rb +0 -347
  266. data/spec/extensions/singular_table_names_spec.rb +0 -22
  267. data/spec/extensions/skip_create_refresh_spec.rb +0 -18
  268. data/spec/extensions/spec_helper.rb +0 -70
  269. data/spec/extensions/split_array_nil_spec.rb +0 -24
  270. data/spec/extensions/split_values_spec.rb +0 -57
  271. data/spec/extensions/sql_comments_spec.rb +0 -33
  272. data/spec/extensions/sql_expr_spec.rb +0 -59
  273. data/spec/extensions/static_cache_cache_spec.rb +0 -35
  274. data/spec/extensions/static_cache_spec.rb +0 -471
  275. data/spec/extensions/string_agg_spec.rb +0 -90
  276. data/spec/extensions/string_date_time_spec.rb +0 -95
  277. data/spec/extensions/string_stripper_spec.rb +0 -68
  278. data/spec/extensions/subclasses_spec.rb +0 -79
  279. data/spec/extensions/subset_conditions_spec.rb +0 -38
  280. data/spec/extensions/symbol_aref_refinement_spec.rb +0 -28
  281. data/spec/extensions/symbol_as_refinement_spec.rb +0 -21
  282. data/spec/extensions/synchronize_sql_spec.rb +0 -124
  283. data/spec/extensions/table_select_spec.rb +0 -83
  284. data/spec/extensions/tactical_eager_loading_spec.rb +0 -402
  285. data/spec/extensions/thread_local_timezones_spec.rb +0 -67
  286. data/spec/extensions/throw_failures_spec.rb +0 -74
  287. data/spec/extensions/timestamps_spec.rb +0 -209
  288. data/spec/extensions/to_dot_spec.rb +0 -153
  289. data/spec/extensions/touch_spec.rb +0 -226
  290. data/spec/extensions/tree_spec.rb +0 -334
  291. data/spec/extensions/typecast_on_load_spec.rb +0 -86
  292. data/spec/extensions/unlimited_update_spec.rb +0 -21
  293. data/spec/extensions/update_or_create_spec.rb +0 -83
  294. data/spec/extensions/update_primary_key_spec.rb +0 -105
  295. data/spec/extensions/update_refresh_spec.rb +0 -59
  296. data/spec/extensions/uuid_spec.rb +0 -101
  297. data/spec/extensions/validate_associated_spec.rb +0 -52
  298. data/spec/extensions/validation_class_methods_spec.rb +0 -1040
  299. data/spec/extensions/validation_contexts_spec.rb +0 -31
  300. data/spec/extensions/validation_helpers_spec.rb +0 -525
  301. data/spec/extensions/whitelist_security_spec.rb +0 -157
  302. data/spec/extensions/xml_serializer_spec.rb +0 -213
  303. data/spec/files/bad_down_migration/001_create_alt_basic.rb +0 -4
  304. data/spec/files/bad_down_migration/002_create_alt_advanced.rb +0 -4
  305. data/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  306. data/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +0 -9
  307. data/spec/files/bad_timestamped_migrations/1273253853_3_create_users.rb +0 -3
  308. data/spec/files/bad_up_migration/001_create_alt_basic.rb +0 -4
  309. data/spec/files/bad_up_migration/002_create_alt_advanced.rb +0 -3
  310. data/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +0 -9
  311. data/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +0 -9
  312. data/spec/files/convert_to_timestamp_migrations/003_3_create_users.rb +0 -4
  313. data/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +0 -9
  314. data/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +0 -9
  315. data/spec/files/double_migration/001_create_sessions.rb +0 -9
  316. data/spec/files/double_migration/002_create_nodes.rb +0 -19
  317. data/spec/files/double_migration/003_3_create_users.rb +0 -4
  318. data/spec/files/duplicate_integer_migrations/001_create_alt_advanced.rb +0 -4
  319. data/spec/files/duplicate_integer_migrations/001_create_alt_basic.rb +0 -4
  320. data/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  321. data/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +0 -9
  322. data/spec/files/duplicate_timestamped_migrations/1273253853_create_users.rb +0 -4
  323. data/spec/files/empty_migration/001_create_sessions.rb +0 -9
  324. data/spec/files/empty_migration/002_create_nodes.rb +0 -0
  325. data/spec/files/empty_migration/003_3_create_users.rb +0 -4
  326. data/spec/files/integer_migrations/001_create_sessions.rb +0 -9
  327. data/spec/files/integer_migrations/002_create_nodes.rb +0 -9
  328. data/spec/files/integer_migrations/003_3_create_users.rb +0 -4
  329. data/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  330. data/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +0 -9
  331. data/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +0 -9
  332. data/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +0 -9
  333. data/spec/files/interleaved_timestamped_migrations/1273253853_3_create_users.rb +0 -4
  334. data/spec/files/missing_integer_migrations/001_create_alt_basic.rb +0 -4
  335. data/spec/files/missing_integer_migrations/003_create_alt_advanced.rb +0 -4
  336. data/spec/files/missing_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  337. data/spec/files/missing_timestamped_migrations/1273253853_3_create_users.rb +0 -4
  338. data/spec/files/reversible_migrations/001_reversible.rb +0 -5
  339. data/spec/files/reversible_migrations/002_reversible.rb +0 -5
  340. data/spec/files/reversible_migrations/003_reversible.rb +0 -5
  341. data/spec/files/reversible_migrations/004_reversible.rb +0 -5
  342. data/spec/files/reversible_migrations/005_reversible.rb +0 -10
  343. data/spec/files/reversible_migrations/006_reversible.rb +0 -10
  344. data/spec/files/reversible_migrations/007_reversible.rb +0 -10
  345. data/spec/files/timestamped_migrations/1273253849_create_sessions.rb +0 -9
  346. data/spec/files/timestamped_migrations/1273253851_create_nodes.rb +0 -9
  347. data/spec/files/timestamped_migrations/1273253853_3_create_users.rb +0 -4
  348. data/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +0 -4
  349. data/spec/files/transaction_specified_migrations/002_create_basic.rb +0 -4
  350. data/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +0 -3
  351. data/spec/files/transaction_unspecified_migrations/002_create_basic.rb +0 -3
  352. data/spec/files/uppercase_timestamped_migrations/1273253849_CREATE_SESSIONS.RB +0 -9
  353. data/spec/files/uppercase_timestamped_migrations/1273253851_CREATE_NODES.RB +0 -9
  354. data/spec/files/uppercase_timestamped_migrations/1273253853_3_CREATE_USERS.RB +0 -4
  355. data/spec/guards_helper.rb +0 -59
  356. data/spec/integration/associations_test.rb +0 -2597
  357. data/spec/integration/database_test.rb +0 -113
  358. data/spec/integration/dataset_test.rb +0 -2037
  359. data/spec/integration/eager_loader_test.rb +0 -687
  360. data/spec/integration/migrator_test.rb +0 -262
  361. data/spec/integration/model_test.rb +0 -203
  362. data/spec/integration/plugin_test.rb +0 -2423
  363. data/spec/integration/prepared_statement_test.rb +0 -405
  364. data/spec/integration/schema_test.rb +0 -903
  365. data/spec/integration/spec_helper.rb +0 -71
  366. data/spec/integration/timezone_test.rb +0 -86
  367. data/spec/integration/transaction_test.rb +0 -603
  368. data/spec/integration/type_test.rb +0 -127
  369. data/spec/model/association_reflection_spec.rb +0 -803
  370. data/spec/model/associations_spec.rb +0 -4738
  371. data/spec/model/base_spec.rb +0 -875
  372. data/spec/model/class_dataset_methods_spec.rb +0 -146
  373. data/spec/model/dataset_methods_spec.rb +0 -198
  374. data/spec/model/eager_loading_spec.rb +0 -2377
  375. data/spec/model/hooks_spec.rb +0 -370
  376. data/spec/model/inflector_spec.rb +0 -26
  377. data/spec/model/model_spec.rb +0 -956
  378. data/spec/model/plugins_spec.rb +0 -429
  379. data/spec/model/record_spec.rb +0 -2118
  380. data/spec/model/spec_helper.rb +0 -46
  381. data/spec/model/validations_spec.rb +0 -220
  382. data/spec/model_no_assoc_spec.rb +0 -1
  383. data/spec/model_spec.rb +0 -1
  384. data/spec/plugin_spec.rb +0 -1
  385. data/spec/sequel_coverage.rb +0 -15
  386. data/spec/sequel_warning.rb +0 -5
  387. data/spec/spec_config.rb +0 -12
@@ -894,7 +894,7 @@ in the most current release.
894
894
 
895
895
  Sequel fully supports the currently supported versions of Ruby (MRI) and JRuby. It may
896
896
  support unsupported versions of Ruby or JRuby, but such support may be dropped in any
897
- minor version of keeping it becomes a support issue. The minimum Ruby version
897
+ minor version if keeping it becomes a support issue. The minimum Ruby version
898
898
  required to run the current version of Sequel is 1.9.2.
899
899
 
900
900
  == Maintainer
@@ -731,7 +731,7 @@ associations:
731
731
  one_to_one :tracks, key: [:disc_number, :number, :album_id], primary_key: [:disc_number, :number, :album_id]
732
732
  end
733
733
 
734
- === Tree - All Ancestors and Descendents
734
+ === Tree - All Ancestors and Descendants
735
735
 
736
736
  Let's say you want to store a tree relationship in your database, it's pretty
737
737
  simple:
@@ -749,7 +749,7 @@ node.children. You can even eager load the relationship up to a certain depth:
749
749
  # Load parents and grandparents for a group of nodes
750
750
  Node.where{id < 10}.eager(parent: :parent).all
751
751
 
752
- What if you want to get all ancestors up to the root node, or all descendents,
752
+ What if you want to get all ancestors up to the root node, or all descendants,
753
753
  without knowing the depth of the tree?
754
754
 
755
755
  class Node < Sequel::Model
@@ -770,7 +770,7 @@ without knowing the depth of the tree?
770
770
  id_map = {}
771
771
  # Create an map of parent_ids to nodes that have that parent id
772
772
  non_root_nodes.each{|n| (id_map[n.parent_id] ||= []) << n}
773
- # Doesn't cause an infinte loop, because when only the root node
773
+ # Doesn't cause an infinite loop, because when only the root node
774
774
  # is left, this is not called.
775
775
  Node.where(id: id_map.keys).eager(:ancestors).all do |node|
776
776
  # Populate the parent association for each node
@@ -879,4 +879,4 @@ associated tickets.
879
879
  end
880
880
 
881
881
  Note that it is often better to use a sum cache instead of this approach. You can implement
882
- a sum cache using +after_create+, +after_update+, and +after_delete+ hooks, or preferrably using a database trigger.
882
+ a sum cache using +after_create+, +after_update+, and +after_delete+ hooks, or preferably using a database trigger.
@@ -113,7 +113,7 @@ many rows in the current table, by using a join table to associate the two table
113
113
  The one_through_one association can be thought of as a subset of the many_to_many
114
114
  association, but where there can only be 0 or 1 records in the associated table.
115
115
  This is useful if there is a unique constraint on the foreign key in the join table
116
- that refrences the current table. It's also useful if you want to impose an order
116
+ that references the current table. It's also useful if you want to impose an order
117
117
  on the association and just want the first record returned. The one_through_one
118
118
  association is so named because it sets up a one-to-one association through a
119
119
  single join table.
@@ -781,7 +781,7 @@ Sequel is designed to be very flexible. If the default behavior of the
781
781
  association modification methods isn't what you desire, you can override
782
782
  the methods in your classes. However, you should be aware that for each
783
783
  of the association modification methods described, there is a private
784
- method that is preceeded by an underscore that does the actual
784
+ method that is preceded by an underscore that does the actual
785
785
  modification. The public method without the underscore handles caching
786
786
  and callbacks, and shouldn't be overridden by the user.
787
787
 
@@ -1069,7 +1069,7 @@ option of the first association, it doesn't attempt to merge them.
1069
1069
  In addition to the options hash, the :clone option will copy a block argument
1070
1070
  from the existing situation. If you want a cloned association to not have the
1071
1071
  same block as the association you are cloning from, specify the block: nil option
1072
- in additon to the :clone option.
1072
+ in addition to the :clone option.
1073
1073
 
1074
1074
  ==== :dataset
1075
1075
 
@@ -7,7 +7,7 @@ this guide will be specific about which are strictly necessary.
7
7
 
8
8
  == Require Sequel
9
9
 
10
- This is sort of a no brainer, but you need to require the library
10
+ This is sort of a no-brainer, but you need to require the library
11
11
  first. This is a strict requirement, none of the other code can
12
12
  be executed unless the library has been required first. Example:
13
13
 
@@ -70,7 +70,7 @@ copied into the subclass when model subclasses are created. Example:
70
70
  == Load Model Classes
71
71
 
72
72
  After you have established a database connection, and configured your
73
- global model configration and global plugins, you can load your model
73
+ global model configuration and global plugins, you can load your model
74
74
  classes. It's recommended to have a separate file for each model class,
75
75
  unless the model classes are very simple. Example:
76
76
 
@@ -91,6 +91,16 @@ unsafe runtime modification of the configuration:
91
91
  model_classes.each(&:freeze)
92
92
  DB.freeze
93
93
 
94
+ The `subclasses` plugin can be used to keep track of all model classes
95
+ that have been setup in your application. Finalizing their associations
96
+ and freezing them can easily be achieved through the plugin:
97
+
98
+ # Register the plugin before setting up the models
99
+ Sequel::Model.plugin :subclasses
100
+ # ... setup models
101
+ # Now finalize associations & freeze models by calling the plugin:
102
+ Sequel::Model.freeze_descendents
103
+
94
104
  == Disconnect If Using Forking Webserver with Code Preloading
95
105
 
96
106
  If you are using a forking webserver such as unicorn or passenger, with
@@ -4,7 +4,7 @@ How you design your model dataset methods can significantly affect the flexibili
4
4
 
5
5
  == Flexibility: Use Single Method Per Task
6
6
 
7
- In general, it is recommended that you have a single method per task for maximum flexibilty. For example, let's say you need to retrieve all albums released in a given year, ordered by number of units sold descending, and only care about the id, name and number of units sold. One way to do this is in your application code (outside the model), you can
7
+ In general, it is recommended that you have a single method per task for maximum flexibility. For example, let's say you need to retrieve all albums released in a given year, ordered by number of units sold descending, and only care about the id, name and number of units sold. One way to do this is in your application code (outside the model), you can
8
8
  call the dataset methods directly:
9
9
 
10
10
  Album.
@@ -139,6 +139,77 @@ conversion via a USING clause, and Sequel supports this using the :using
139
139
  # ALTER TABLE "table" ALTER COLUMN "unix_time" TYPE timestamp
140
140
  # USING (CAST('epoch' AS timestamp) + (CAST('1 second' AS interval) * "unix_time"))
141
141
 
142
+ === Creating Partitioned Tables
143
+
144
+ PostgreSQL allows marking tables as partitioned tables, and adding partitions to such tables. Sequel
145
+ offers support for this. You can create a partitioned table using the +:partition_by+ option and
146
+ +:partition_type+ options (the default partition type is range partitioning):
147
+
148
+ DB.create_table(:table1, partition_by: :column, partition_type: :range) do
149
+ Integer :id
150
+ Date :column
151
+ end
152
+
153
+ DB.create_table(:table2, partition_by: :column, partition_type: :list) do
154
+ Integer :id
155
+ String :column
156
+ end
157
+
158
+ DB.create_table(:table3, partition_by: :column, partition_type: :hash) do
159
+ Integer :id
160
+ Integer :column
161
+ end
162
+
163
+ To add partitions of other tables, you use the +:partition_of+ option. This option will use
164
+ a custom DSL specific to partitioning other tables. For range partitioning, you can use the
165
+ +from+ and +to+ methods to specify the inclusive beginning and exclusive ending of the
166
+ range of the partition. You can call the +minvalue+ and +maxvalue+ methods to get the minimum
167
+ and maximum values for the column(s) in the range, useful as arguments to +from+ and +to+:
168
+
169
+ DB.create_table(:table1a, partition_of: :table1) do
170
+ from minvalue
171
+ to 0
172
+ end
173
+ DB.create_table(:table1b, partition_of: :table1) do
174
+ from 0
175
+ to 100
176
+ end
177
+ DB.create_table(:table1c, partition_of: :table1) do
178
+ from 100
179
+ to maxvalue
180
+ end
181
+
182
+ For list partitioning, you use the +values_in+ method. You can also use the +default+ method
183
+ to mark a partition as the default partition:
184
+
185
+ DB.create_table(:table2a, partition_of: :table2) do
186
+ values_in 1, 2, 3
187
+ end
188
+ DB.create_table(:table2b, partition_of: :table2) do
189
+ values_in 4, 5, 6
190
+ end
191
+ DB.create_table(:table2c, partition_of: :table2) do
192
+ default
193
+ end
194
+
195
+ For hash partitioning, you use the +modulus+ and +remainder+ methods:
196
+
197
+ DB.create_table(:table3a, partition_of: :table3) do
198
+ modulus 3
199
+ remainder 0
200
+ end
201
+ DB.create_table(:table3b, partition_of: :table3) do
202
+ modulus 3
203
+ remainder 1
204
+ end
205
+ DB.create_table(:table3c, partition_of: :table3) do
206
+ modulus 3
207
+ remainder 2
208
+ end
209
+
210
+ There is currently no support for using custom column or table constraints in partitions of
211
+ other tables. Support may be added in the future.
212
+
142
213
  === Creating Unlogged Tables
143
214
 
144
215
  PostgreSQL allows users to create unlogged tables, which are faster but not crash safe. Sequel
@@ -0,0 +1,20 @@
1
+ = New Features
2
+
3
+ * Sequel now supports generated columns on SQLite 3.31+ using the
4
+ :generated_always_as and :generated_type options. Example:
5
+
6
+ DB.create_table(:table) do
7
+ primary_key :id
8
+ Numeric :amount, null: false
9
+ Numeric :tax, null: false
10
+ Numeric :total, generated_always_as: (Sequel[:amount] + :tax)
11
+ end
12
+
13
+ = Other Improvements
14
+
15
+ * The Database#transaction :before_retry option is now called before
16
+ retrying the transaction even when the :num_retries option is set
17
+ to nil.
18
+
19
+ * The gem no longer ships with specs and older release notes, reducing
20
+ the gem size by over 40%.
@@ -0,0 +1,148 @@
1
+ = New Features
2
+
3
+ * A forbid_lazy_load plugin has been added to forbid the lazy loading
4
+ of model associations if the current object was retreived with other
5
+ objects. This plugin helps detect N+1 query issues. This plugin
6
+ will raise an error if a lazy load is detected in such cases:
7
+
8
+ Album.plugin :forbid_lazy_load
9
+ Album.one_to_many :tracks
10
+
11
+ Album.each do |album|
12
+ album.tracks
13
+ # Could be N+1, raises Sequel::Plugins::ForbidLazyLoad::Error
14
+ end
15
+
16
+ Album.first.tracks
17
+ # Could not be N+1, no error raised
18
+
19
+ The forbid_lazy_load plugin is designed to be loaded into the base
20
+ model class (generally Sequel::Model), and can be loaded only in
21
+ test mode, or only in certain test mode configurations, so that it
22
+ does not have any production performance impact.
23
+
24
+ Note that an alternative approach that Sequel has supported for many
25
+ years is the tactical_eager_loading plugin, which automatically
26
+ eager loads when an N+1 query issue is detected.
27
+
28
+ * An association_lazy_eager_option plugin has been added which supports
29
+ the :eager option for the association method. If the association has
30
+ not been loaded, this eagerly loads the associations specified by the
31
+ :eager option when loading the association. If the association has
32
+ already been loaded, this option is ignored, with the assumption that
33
+ whatever loaded the association already used the correct eager
34
+ loading. Example:
35
+
36
+ Album.plugin :association_lazy_eager_option
37
+ Album.one_to_many :tracks
38
+ Track.many_to_one :artist
39
+
40
+ album = Album.first
41
+ album.tracks(:eager=>:artist)
42
+ # Loads tracks for album, then artist for each track (2 queries)
43
+
44
+ album.tracks(:eager=>:artist)
45
+ # No query issued as association is cached
46
+
47
+ You could previously have similar behavior for uncached associations
48
+ by passing a block to the association method and calling eager on
49
+ the yielded dataset. However, that would ignore any cached
50
+ association, causing redundant loading of the association in such
51
+ cases.
52
+
53
+ * On PostgreSQL 10+, creating partitioned tables and partitions of
54
+ other tables is now supported.
55
+
56
+ To create a partitioned table, use the :partition_by option:
57
+
58
+ DB.create_table(:table1, partition_by: :date_column,
59
+ partition_type: :range) do
60
+ Integer :id
61
+ Date :date_column
62
+ end
63
+
64
+ DB.create_table(:table2, partition_by: :string_column,
65
+ partition_type: :list) do
66
+ Integer :id
67
+ String :string_column
68
+ end
69
+
70
+ DB.create_table(:table3, partition_by: :int_column,
71
+ partition_type: :hash) do
72
+ Integer :id
73
+ Integer :int_column
74
+ end
75
+
76
+ To add partitions of other tables, use the :partition_of option.
77
+ This option will use a custom DSL specific to partitions of other
78
+ tables.
79
+
80
+ For range partitioning, you can use the from and to methods to
81
+ specify the inclusive beginning and exclusive ending of the range
82
+ of the partition. You can call the minvalue and maxvalue methods
83
+ to get the minimum and maximum values for the column(s) in the
84
+ range, useful as arguments to from and to:
85
+
86
+ DB.create_table(:table1a, partition_of: :table1) do
87
+ from minvalue
88
+ to 0
89
+ end
90
+ DB.create_table(:table1b, partition_of: :table1) do
91
+ from 0
92
+ to 100
93
+ end
94
+ DB.create_table(:table1c, partition_of: :table1) do
95
+ from 100
96
+ to maxvalue
97
+ end
98
+
99
+ For list partitioning, you use the values_in method. You can also
100
+ use the default method to mark a partition as the default partition:
101
+
102
+ DB.create_table(:table2a, partition_of: :table2) do
103
+ values_in 1, 2, 3
104
+ end
105
+ DB.create_table(:table2b, partition_of: :table2) do
106
+ values_in 4, 5, 6
107
+ end
108
+ DB.create_table(:table2c, partition_of: :table2) do
109
+ default
110
+ end
111
+
112
+ For hash partitioning, you use the modulus and remainder methods:
113
+
114
+ DB.create_table(:table3a, partition_of: :table3) do
115
+ modulus 3
116
+ remainder 0
117
+ end
118
+ DB.create_table(:table3b, partition_of: :table3) do
119
+ modulus 3
120
+ remainder 1
121
+ end
122
+ DB.create_table(:table3c, partition_of: :table3) do
123
+ modulus 3
124
+ remainder 2
125
+ end
126
+
127
+ * On PostgreSQL 12+ and SQLite 3.31+, column schema hashes now have
128
+ a :generated entry for whether the column is a generated column.
129
+
130
+ * The schema_dumper extension now dumps generated columns correctly
131
+ when using the :same_db option on PostgreSQL 12+.
132
+
133
+ * A skip_saving_columns plugin has been added. This allows skipping
134
+ saving of specific columns for the model. By default, it skips
135
+ saving of generated columns, but you can customize the columns
136
+ that it skips:
137
+
138
+ Album.plugin :skip_saving_columns
139
+ Album.skip_saving_columns = [:some_column]
140
+
141
+ = Other Improvements
142
+
143
+ * The alter_table drop_constraint :primary_key option on SQLite now
144
+ works correctly for non-integer primary keys.
145
+
146
+ * When an error is raised due to an irreversible migration, the error
147
+ message now includes the file containing the migration for easier
148
+ debugging.
@@ -0,0 +1,46 @@
1
+ = New Features
2
+
3
+ * A fiber_concurrency extension has been added, for using
4
+ Fiber.current instead of Thread.current when checking out a
5
+ connection. This allows separate fibers of the same thread
6
+ to use separate connections. In addition to allowing direct use
7
+ of fibers, this also allows concurrent use of multiple enumerators
8
+ that use database connections in the same thread.
9
+
10
+ When using this extension, you must be careful and ensure that you
11
+ are not using more concurrent fibers than your connection pool size.
12
+ Otherwise, all fibers will block while one fiber waits until a
13
+ connection is available. It is possible this issue will be
14
+ addressed when Ruby implements a fiber scheduler (currently
15
+ being discussed for inclusion in Ruby 3).
16
+
17
+ * A run_transaction_hooks Database extension has been added,
18
+ allowing for running the transaction hooks before commit/rollback,
19
+ which can be helpful for testing the hooks when using transactional
20
+ testing.
21
+
22
+ = Other Improvements
23
+
24
+ * Database#create_table? now works correctly with the :partition_of
25
+ option on PostgreSQL.
26
+
27
+ * The timestamp(N) with time zone type is now recognized by the
28
+ schema parser.
29
+
30
+ * Singleton methods of the Sequel module have now been moved into a
31
+ Sequel::SequelMethods module. This allows you to extend Sequel
32
+ with a module that overrides the methods and call super to get
33
+ the default behavior.
34
+
35
+ * The pg_inet extension no longer defines inet/cidr conversion procs
36
+ if sequel_pg 1.13.0+ is in use. This is because sequel_pg 1.13.0+
37
+ will respect the conversion procs and defining them makes things
38
+ slower. sequel_pg 1.13.0+ handles the same conversion by default
39
+ without needing a conversion proc.
40
+
41
+ * Method visibility issues in the model, plugin, extension, and adapter
42
+ code have been fixed. Most cases fixed were private methods being
43
+ accidentally made public when they were overridden.
44
+
45
+ During this change, Model#_insert_values was changed from public to
46
+ private, since it was originally intended to be private.
@@ -0,0 +1,24 @@
1
+ = New Features
2
+
3
+ * Custom join types are now supported on a per-association basis when
4
+ using eager_graph/association_join. This builds on the previous
5
+ support for custom aliases, using Sequel::SQL::AliasedExpression:
6
+
7
+ class Artist < Sequel::Model; end
8
+ class Album < Sequel::Model; end
9
+ class Track < Sequel::Model; end
10
+ Artist.one_to_many :albums
11
+ Album.one_to_many :tracks
12
+ Artist.eager_graph(
13
+ Sequel[:albums].as(:a, join_type: :inner) =>
14
+ Sequel[:tracks].as(:t, join_type: :left)
15
+ )
16
+
17
+ * A Database#current_timestamp_utc accessor has been added on SQLite.
18
+ Setting this to true will keep CURRENT_TIMESTAMP, CURRENT_TIME, and
19
+ CURRENT_DATE in UTC instead of converting them to localtime.
20
+
21
+ = Other Improvements
22
+
23
+ * The smallserial PostgreSQL type is now recognized and Sequel will
24
+ not try to mark smallserial columns as identity columns.
@@ -0,0 +1,40 @@
1
+ = New Features
2
+
3
+ * The association_pks plugin now creates *_pks_dataset methods for
4
+ each association. These are similar to the existing *_pks getter
5
+ methods, but they return a dataset of the keys instead of the keys
6
+ themselves.
7
+
8
+ * The association_pks plugin now supports a :cache_pks association
9
+ option, which will cache calls to the *_pks getter method. The
10
+ default behavior remains that the *_pks getter method only returns
11
+ cached values if the *_pks= setter method has been used to set the
12
+ values.
13
+
14
+ * The *_pks getter methods supported by the association_pks plugin
15
+ now support a :refresh option to ignore any cached values, similar
16
+ to how the association getter methods work.
17
+
18
+ = Other Improvements
19
+
20
+ * If trying to disconnect a server that doesn't exist when using a
21
+ sharded connection pool, a Sequel::Error is now raised. Previously,
22
+ the sharded threaded pool raised a NoMethodError and the sharded
23
+ single connection pool did not raise an error.
24
+
25
+ * If using the :savepoint option when savepoints are not supported,
26
+ a Sequel::InvalidOperation exception is now raised, instead of a
27
+ NoMethodError.
28
+
29
+ * Calling Dataset#eager_graph with no arguments now returns the
30
+ dataset.
31
+
32
+ * If not connected to the database, the single connection pool will
33
+ not yield any connections to Database#pool.all_connections.
34
+
35
+ * Forcing a :ruby eager limit strategy for an association without a
36
+ limit or offset now works correctly.
37
+
38
+ * Multiple unnecessary conditionals have been removed.
39
+
40
+ * Sequel core and model code now have 100% branch coverage.