sequel 5.28.0 → 5.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (380) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +64 -1922
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/doc/advanced_associations.rdoc +4 -4
  6. data/doc/association_basics.rdoc +3 -3
  7. data/doc/code_order.rdoc +12 -2
  8. data/doc/model_dataset_method_design.rdoc +1 -1
  9. data/doc/postgresql.rdoc +71 -0
  10. data/doc/release_notes/5.29.0.txt +22 -0
  11. data/doc/release_notes/5.30.0.txt +20 -0
  12. data/doc/release_notes/5.31.0.txt +148 -0
  13. data/doc/release_notes/5.32.0.txt +46 -0
  14. data/doc/release_notes/5.33.0.txt +24 -0
  15. data/doc/testing.rdoc +1 -1
  16. data/lib/sequel/adapters/postgres.rb +5 -1
  17. data/lib/sequel/adapters/shared/access.rb +6 -6
  18. data/lib/sequel/adapters/shared/mssql.rb +5 -5
  19. data/lib/sequel/adapters/shared/mysql.rb +10 -10
  20. data/lib/sequel/adapters/shared/oracle.rb +16 -16
  21. data/lib/sequel/adapters/shared/postgres.rb +169 -14
  22. data/lib/sequel/adapters/shared/sqlanywhere.rb +9 -9
  23. data/lib/sequel/adapters/shared/sqlite.rb +32 -5
  24. data/lib/sequel/adapters/tinytds.rb +1 -1
  25. data/lib/sequel/connection_pool/sharded_threaded.rb +2 -2
  26. data/lib/sequel/connection_pool/threaded.rb +1 -1
  27. data/lib/sequel/core.rb +318 -314
  28. data/lib/sequel/database/query.rb +1 -1
  29. data/lib/sequel/database/schema_generator.rb +1 -1
  30. data/lib/sequel/database/transactions.rb +8 -12
  31. data/lib/sequel/dataset/misc.rb +2 -2
  32. data/lib/sequel/extensions/connection_expiration.rb +2 -2
  33. data/lib/sequel/extensions/connection_validator.rb +2 -2
  34. data/lib/sequel/extensions/fiber_concurrency.rb +24 -0
  35. data/lib/sequel/extensions/index_caching.rb +9 -7
  36. data/lib/sequel/extensions/integer64.rb +2 -0
  37. data/lib/sequel/extensions/migration.rb +1 -1
  38. data/lib/sequel/extensions/pg_enum.rb +5 -2
  39. data/lib/sequel/extensions/pg_hstore.rb +6 -0
  40. data/lib/sequel/extensions/pg_inet.rb +13 -5
  41. data/lib/sequel/extensions/pg_interval.rb +2 -0
  42. data/lib/sequel/extensions/pg_range.rb +2 -0
  43. data/lib/sequel/extensions/pg_timestamptz.rb +2 -0
  44. data/lib/sequel/extensions/run_transaction_hooks.rb +72 -0
  45. data/lib/sequel/extensions/schema_dumper.rb +10 -4
  46. data/lib/sequel/extensions/server_block.rb +3 -3
  47. data/lib/sequel/model/associations.rb +18 -5
  48. data/lib/sequel/model/base.rb +60 -53
  49. data/lib/sequel/model/plugins.rb +1 -0
  50. data/lib/sequel/plugins/association_lazy_eager_option.rb +66 -0
  51. data/lib/sequel/plugins/association_multi_add_remove.rb +2 -0
  52. data/lib/sequel/plugins/association_proxies.rb +2 -0
  53. data/lib/sequel/plugins/boolean_subsets.rb +4 -1
  54. data/lib/sequel/plugins/class_table_inheritance.rb +26 -26
  55. data/lib/sequel/plugins/dirty.rb +13 -13
  56. data/lib/sequel/plugins/empty_failure_backtraces.rb +38 -0
  57. data/lib/sequel/plugins/forbid_lazy_load.rb +214 -0
  58. data/lib/sequel/plugins/json_serializer.rb +18 -11
  59. data/lib/sequel/plugins/single_table_inheritance.rb +15 -15
  60. data/lib/sequel/plugins/skip_saving_columns.rb +108 -0
  61. data/lib/sequel/plugins/subclasses.rb +2 -0
  62. data/lib/sequel/plugins/throw_failures.rb +1 -1
  63. data/lib/sequel/timezones.rb +6 -4
  64. data/lib/sequel/version.rb +1 -1
  65. metadata +18 -367
  66. data/Rakefile +0 -151
  67. data/doc/release_notes/4.0.0.txt +0 -262
  68. data/doc/release_notes/4.1.0.txt +0 -85
  69. data/doc/release_notes/4.10.0.txt +0 -226
  70. data/doc/release_notes/4.11.0.txt +0 -147
  71. data/doc/release_notes/4.12.0.txt +0 -105
  72. data/doc/release_notes/4.13.0.txt +0 -169
  73. data/doc/release_notes/4.14.0.txt +0 -68
  74. data/doc/release_notes/4.15.0.txt +0 -56
  75. data/doc/release_notes/4.16.0.txt +0 -36
  76. data/doc/release_notes/4.17.0.txt +0 -38
  77. data/doc/release_notes/4.18.0.txt +0 -36
  78. data/doc/release_notes/4.19.0.txt +0 -45
  79. data/doc/release_notes/4.2.0.txt +0 -129
  80. data/doc/release_notes/4.20.0.txt +0 -79
  81. data/doc/release_notes/4.21.0.txt +0 -94
  82. data/doc/release_notes/4.22.0.txt +0 -72
  83. data/doc/release_notes/4.23.0.txt +0 -65
  84. data/doc/release_notes/4.24.0.txt +0 -99
  85. data/doc/release_notes/4.25.0.txt +0 -181
  86. data/doc/release_notes/4.26.0.txt +0 -44
  87. data/doc/release_notes/4.27.0.txt +0 -78
  88. data/doc/release_notes/4.28.0.txt +0 -57
  89. data/doc/release_notes/4.29.0.txt +0 -41
  90. data/doc/release_notes/4.3.0.txt +0 -40
  91. data/doc/release_notes/4.30.0.txt +0 -37
  92. data/doc/release_notes/4.31.0.txt +0 -57
  93. data/doc/release_notes/4.32.0.txt +0 -132
  94. data/doc/release_notes/4.33.0.txt +0 -88
  95. data/doc/release_notes/4.34.0.txt +0 -86
  96. data/doc/release_notes/4.35.0.txt +0 -130
  97. data/doc/release_notes/4.36.0.txt +0 -116
  98. data/doc/release_notes/4.37.0.txt +0 -50
  99. data/doc/release_notes/4.38.0.txt +0 -67
  100. data/doc/release_notes/4.39.0.txt +0 -127
  101. data/doc/release_notes/4.4.0.txt +0 -92
  102. data/doc/release_notes/4.40.0.txt +0 -179
  103. data/doc/release_notes/4.41.0.txt +0 -77
  104. data/doc/release_notes/4.42.0.txt +0 -221
  105. data/doc/release_notes/4.43.0.txt +0 -87
  106. data/doc/release_notes/4.44.0.txt +0 -125
  107. data/doc/release_notes/4.45.0.txt +0 -370
  108. data/doc/release_notes/4.46.0.txt +0 -404
  109. data/doc/release_notes/4.47.0.txt +0 -56
  110. data/doc/release_notes/4.48.0.txt +0 -293
  111. data/doc/release_notes/4.49.0.txt +0 -222
  112. data/doc/release_notes/4.5.0.txt +0 -34
  113. data/doc/release_notes/4.6.0.txt +0 -30
  114. data/doc/release_notes/4.7.0.txt +0 -103
  115. data/doc/release_notes/4.8.0.txt +0 -175
  116. data/doc/release_notes/4.9.0.txt +0 -190
  117. data/spec/adapter_spec.rb +0 -4
  118. data/spec/adapters/db2_spec.rb +0 -170
  119. data/spec/adapters/mssql_spec.rb +0 -828
  120. data/spec/adapters/mysql_spec.rb +0 -1060
  121. data/spec/adapters/oracle_spec.rb +0 -371
  122. data/spec/adapters/postgres_spec.rb +0 -4476
  123. data/spec/adapters/spec_helper.rb +0 -44
  124. data/spec/adapters/sqlanywhere_spec.rb +0 -97
  125. data/spec/adapters/sqlite_spec.rb +0 -652
  126. data/spec/bin_spec.rb +0 -278
  127. data/spec/core/connection_pool_spec.rb +0 -1250
  128. data/spec/core/database_spec.rb +0 -2915
  129. data/spec/core/dataset_spec.rb +0 -5547
  130. data/spec/core/deprecated_spec.rb +0 -70
  131. data/spec/core/expression_filters_spec.rb +0 -1498
  132. data/spec/core/mock_adapter_spec.rb +0 -722
  133. data/spec/core/object_graph_spec.rb +0 -336
  134. data/spec/core/placeholder_literalizer_spec.rb +0 -166
  135. data/spec/core/schema_generator_spec.rb +0 -214
  136. data/spec/core/schema_spec.rb +0 -1844
  137. data/spec/core/spec_helper.rb +0 -24
  138. data/spec/core/version_spec.rb +0 -14
  139. data/spec/core_extensions_spec.rb +0 -763
  140. data/spec/core_model_spec.rb +0 -2
  141. data/spec/core_spec.rb +0 -1
  142. data/spec/deprecation_helper.rb +0 -30
  143. data/spec/extensions/accessed_columns_spec.rb +0 -51
  144. data/spec/extensions/active_model_spec.rb +0 -99
  145. data/spec/extensions/after_initialize_spec.rb +0 -28
  146. data/spec/extensions/any_not_empty_spec.rb +0 -23
  147. data/spec/extensions/arbitrary_servers_spec.rb +0 -109
  148. data/spec/extensions/association_dependencies_spec.rb +0 -125
  149. data/spec/extensions/association_multi_add_remove_spec.rb +0 -1041
  150. data/spec/extensions/association_pks_spec.rb +0 -423
  151. data/spec/extensions/association_proxies_spec.rb +0 -100
  152. data/spec/extensions/auto_literal_strings_spec.rb +0 -205
  153. data/spec/extensions/auto_validations_spec.rb +0 -229
  154. data/spec/extensions/blacklist_security_spec.rb +0 -95
  155. data/spec/extensions/blank_spec.rb +0 -69
  156. data/spec/extensions/boolean_readers_spec.rb +0 -93
  157. data/spec/extensions/boolean_subsets_spec.rb +0 -47
  158. data/spec/extensions/caching_spec.rb +0 -273
  159. data/spec/extensions/caller_logging_spec.rb +0 -52
  160. data/spec/extensions/class_table_inheritance_spec.rb +0 -750
  161. data/spec/extensions/column_conflicts_spec.rb +0 -75
  162. data/spec/extensions/column_select_spec.rb +0 -129
  163. data/spec/extensions/columns_introspection_spec.rb +0 -90
  164. data/spec/extensions/columns_updated_spec.rb +0 -35
  165. data/spec/extensions/composition_spec.rb +0 -248
  166. data/spec/extensions/connection_expiration_spec.rb +0 -151
  167. data/spec/extensions/connection_validator_spec.rb +0 -144
  168. data/spec/extensions/constant_sql_override_spec.rb +0 -24
  169. data/spec/extensions/constraint_validations_plugin_spec.rb +0 -300
  170. data/spec/extensions/constraint_validations_spec.rb +0 -439
  171. data/spec/extensions/core_refinements_spec.rb +0 -528
  172. data/spec/extensions/csv_serializer_spec.rb +0 -183
  173. data/spec/extensions/current_datetime_timestamp_spec.rb +0 -27
  174. data/spec/extensions/dataset_associations_spec.rb +0 -365
  175. data/spec/extensions/dataset_source_alias_spec.rb +0 -51
  176. data/spec/extensions/date_arithmetic_spec.rb +0 -181
  177. data/spec/extensions/datetime_parse_to_time_spec.rb +0 -169
  178. data/spec/extensions/def_dataset_method_spec.rb +0 -100
  179. data/spec/extensions/defaults_setter_spec.rb +0 -150
  180. data/spec/extensions/delay_add_association_spec.rb +0 -73
  181. data/spec/extensions/dirty_spec.rb +0 -222
  182. data/spec/extensions/duplicate_columns_handler_spec.rb +0 -104
  183. data/spec/extensions/eager_each_spec.rb +0 -62
  184. data/spec/extensions/eager_graph_eager_spec.rb +0 -100
  185. data/spec/extensions/empty_array_consider_nulls_spec.rb +0 -24
  186. data/spec/extensions/error_splitter_spec.rb +0 -18
  187. data/spec/extensions/error_sql_spec.rb +0 -20
  188. data/spec/extensions/escaped_like_spec.rb +0 -40
  189. data/spec/extensions/eval_inspect_spec.rb +0 -81
  190. data/spec/extensions/exclude_or_null_spec.rb +0 -15
  191. data/spec/extensions/finder_spec.rb +0 -260
  192. data/spec/extensions/force_encoding_spec.rb +0 -126
  193. data/spec/extensions/freeze_datasets_spec.rb +0 -31
  194. data/spec/extensions/graph_each_spec.rb +0 -113
  195. data/spec/extensions/hook_class_methods_spec.rb +0 -402
  196. data/spec/extensions/identifier_mangling_spec.rb +0 -201
  197. data/spec/extensions/implicit_subquery_spec.rb +0 -58
  198. data/spec/extensions/index_caching_spec.rb +0 -66
  199. data/spec/extensions/inflector_spec.rb +0 -183
  200. data/spec/extensions/input_transformer_spec.rb +0 -69
  201. data/spec/extensions/insert_conflict_spec.rb +0 -103
  202. data/spec/extensions/insert_returning_select_spec.rb +0 -72
  203. data/spec/extensions/instance_filters_spec.rb +0 -79
  204. data/spec/extensions/instance_hooks_spec.rb +0 -246
  205. data/spec/extensions/integer64_spec.rb +0 -22
  206. data/spec/extensions/inverted_subsets_spec.rb +0 -33
  207. data/spec/extensions/json_serializer_spec.rb +0 -336
  208. data/spec/extensions/lazy_attributes_spec.rb +0 -183
  209. data/spec/extensions/list_spec.rb +0 -291
  210. data/spec/extensions/looser_typecasting_spec.rb +0 -43
  211. data/spec/extensions/many_through_many_spec.rb +0 -2177
  212. data/spec/extensions/migration_spec.rb +0 -864
  213. data/spec/extensions/modification_detection_spec.rb +0 -93
  214. data/spec/extensions/mssql_optimistic_locking_spec.rb +0 -92
  215. data/spec/extensions/named_timezones_spec.rb +0 -218
  216. data/spec/extensions/nested_attributes_spec.rb +0 -815
  217. data/spec/extensions/null_dataset_spec.rb +0 -85
  218. data/spec/extensions/optimistic_locking_spec.rb +0 -127
  219. data/spec/extensions/pagination_spec.rb +0 -116
  220. data/spec/extensions/pg_array_associations_spec.rb +0 -802
  221. data/spec/extensions/pg_array_ops_spec.rb +0 -144
  222. data/spec/extensions/pg_array_spec.rb +0 -398
  223. data/spec/extensions/pg_auto_constraint_validations_spec.rb +0 -209
  224. data/spec/extensions/pg_enum_spec.rb +0 -118
  225. data/spec/extensions/pg_extended_date_support_spec.rb +0 -126
  226. data/spec/extensions/pg_hstore_ops_spec.rb +0 -238
  227. data/spec/extensions/pg_hstore_spec.rb +0 -219
  228. data/spec/extensions/pg_inet_ops_spec.rb +0 -102
  229. data/spec/extensions/pg_inet_spec.rb +0 -72
  230. data/spec/extensions/pg_interval_spec.rb +0 -103
  231. data/spec/extensions/pg_json_ops_spec.rb +0 -356
  232. data/spec/extensions/pg_json_spec.rb +0 -451
  233. data/spec/extensions/pg_loose_count_spec.rb +0 -23
  234. data/spec/extensions/pg_range_ops_spec.rb +0 -60
  235. data/spec/extensions/pg_range_spec.rb +0 -600
  236. data/spec/extensions/pg_row_ops_spec.rb +0 -61
  237. data/spec/extensions/pg_row_plugin_spec.rb +0 -60
  238. data/spec/extensions/pg_row_spec.rb +0 -363
  239. data/spec/extensions/pg_static_cache_updater_spec.rb +0 -93
  240. data/spec/extensions/pg_timestamptz_spec.rb +0 -17
  241. data/spec/extensions/prepared_statements_safe_spec.rb +0 -66
  242. data/spec/extensions/prepared_statements_spec.rb +0 -177
  243. data/spec/extensions/pretty_table_spec.rb +0 -123
  244. data/spec/extensions/query_spec.rb +0 -94
  245. data/spec/extensions/rcte_tree_spec.rb +0 -387
  246. data/spec/extensions/round_timestamps_spec.rb +0 -39
  247. data/spec/extensions/s_spec.rb +0 -60
  248. data/spec/extensions/schema_caching_spec.rb +0 -64
  249. data/spec/extensions/schema_dumper_spec.rb +0 -870
  250. data/spec/extensions/select_remove_spec.rb +0 -38
  251. data/spec/extensions/sequel_4_dataset_methods_spec.rb +0 -121
  252. data/spec/extensions/serialization_modification_detection_spec.rb +0 -98
  253. data/spec/extensions/serialization_spec.rb +0 -365
  254. data/spec/extensions/server_block_spec.rb +0 -135
  255. data/spec/extensions/server_logging_spec.rb +0 -45
  256. data/spec/extensions/sharding_spec.rb +0 -197
  257. data/spec/extensions/shared_caching_spec.rb +0 -151
  258. data/spec/extensions/single_table_inheritance_spec.rb +0 -347
  259. data/spec/extensions/singular_table_names_spec.rb +0 -22
  260. data/spec/extensions/skip_create_refresh_spec.rb +0 -18
  261. data/spec/extensions/spec_helper.rb +0 -70
  262. data/spec/extensions/split_array_nil_spec.rb +0 -24
  263. data/spec/extensions/split_values_spec.rb +0 -57
  264. data/spec/extensions/sql_comments_spec.rb +0 -33
  265. data/spec/extensions/sql_expr_spec.rb +0 -59
  266. data/spec/extensions/static_cache_cache_spec.rb +0 -35
  267. data/spec/extensions/static_cache_spec.rb +0 -471
  268. data/spec/extensions/string_agg_spec.rb +0 -90
  269. data/spec/extensions/string_date_time_spec.rb +0 -95
  270. data/spec/extensions/string_stripper_spec.rb +0 -68
  271. data/spec/extensions/subclasses_spec.rb +0 -79
  272. data/spec/extensions/subset_conditions_spec.rb +0 -38
  273. data/spec/extensions/symbol_aref_refinement_spec.rb +0 -28
  274. data/spec/extensions/symbol_as_refinement_spec.rb +0 -21
  275. data/spec/extensions/synchronize_sql_spec.rb +0 -124
  276. data/spec/extensions/table_select_spec.rb +0 -83
  277. data/spec/extensions/tactical_eager_loading_spec.rb +0 -402
  278. data/spec/extensions/thread_local_timezones_spec.rb +0 -67
  279. data/spec/extensions/throw_failures_spec.rb +0 -74
  280. data/spec/extensions/timestamps_spec.rb +0 -209
  281. data/spec/extensions/to_dot_spec.rb +0 -153
  282. data/spec/extensions/touch_spec.rb +0 -226
  283. data/spec/extensions/tree_spec.rb +0 -334
  284. data/spec/extensions/typecast_on_load_spec.rb +0 -86
  285. data/spec/extensions/unlimited_update_spec.rb +0 -21
  286. data/spec/extensions/update_or_create_spec.rb +0 -83
  287. data/spec/extensions/update_primary_key_spec.rb +0 -105
  288. data/spec/extensions/update_refresh_spec.rb +0 -59
  289. data/spec/extensions/uuid_spec.rb +0 -101
  290. data/spec/extensions/validate_associated_spec.rb +0 -52
  291. data/spec/extensions/validation_class_methods_spec.rb +0 -1040
  292. data/spec/extensions/validation_contexts_spec.rb +0 -31
  293. data/spec/extensions/validation_helpers_spec.rb +0 -525
  294. data/spec/extensions/whitelist_security_spec.rb +0 -157
  295. data/spec/extensions/xml_serializer_spec.rb +0 -213
  296. data/spec/files/bad_down_migration/001_create_alt_basic.rb +0 -4
  297. data/spec/files/bad_down_migration/002_create_alt_advanced.rb +0 -4
  298. data/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  299. data/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +0 -9
  300. data/spec/files/bad_timestamped_migrations/1273253853_3_create_users.rb +0 -3
  301. data/spec/files/bad_up_migration/001_create_alt_basic.rb +0 -4
  302. data/spec/files/bad_up_migration/002_create_alt_advanced.rb +0 -3
  303. data/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +0 -9
  304. data/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +0 -9
  305. data/spec/files/convert_to_timestamp_migrations/003_3_create_users.rb +0 -4
  306. data/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +0 -9
  307. data/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +0 -9
  308. data/spec/files/double_migration/001_create_sessions.rb +0 -9
  309. data/spec/files/double_migration/002_create_nodes.rb +0 -19
  310. data/spec/files/double_migration/003_3_create_users.rb +0 -4
  311. data/spec/files/duplicate_integer_migrations/001_create_alt_advanced.rb +0 -4
  312. data/spec/files/duplicate_integer_migrations/001_create_alt_basic.rb +0 -4
  313. data/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  314. data/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +0 -9
  315. data/spec/files/duplicate_timestamped_migrations/1273253853_create_users.rb +0 -4
  316. data/spec/files/empty_migration/001_create_sessions.rb +0 -9
  317. data/spec/files/empty_migration/002_create_nodes.rb +0 -0
  318. data/spec/files/empty_migration/003_3_create_users.rb +0 -4
  319. data/spec/files/integer_migrations/001_create_sessions.rb +0 -9
  320. data/spec/files/integer_migrations/002_create_nodes.rb +0 -9
  321. data/spec/files/integer_migrations/003_3_create_users.rb +0 -4
  322. data/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  323. data/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +0 -9
  324. data/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +0 -9
  325. data/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +0 -9
  326. data/spec/files/interleaved_timestamped_migrations/1273253853_3_create_users.rb +0 -4
  327. data/spec/files/missing_integer_migrations/001_create_alt_basic.rb +0 -4
  328. data/spec/files/missing_integer_migrations/003_create_alt_advanced.rb +0 -4
  329. data/spec/files/missing_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  330. data/spec/files/missing_timestamped_migrations/1273253853_3_create_users.rb +0 -4
  331. data/spec/files/reversible_migrations/001_reversible.rb +0 -5
  332. data/spec/files/reversible_migrations/002_reversible.rb +0 -5
  333. data/spec/files/reversible_migrations/003_reversible.rb +0 -5
  334. data/spec/files/reversible_migrations/004_reversible.rb +0 -5
  335. data/spec/files/reversible_migrations/005_reversible.rb +0 -10
  336. data/spec/files/reversible_migrations/006_reversible.rb +0 -10
  337. data/spec/files/reversible_migrations/007_reversible.rb +0 -10
  338. data/spec/files/timestamped_migrations/1273253849_create_sessions.rb +0 -9
  339. data/spec/files/timestamped_migrations/1273253851_create_nodes.rb +0 -9
  340. data/spec/files/timestamped_migrations/1273253853_3_create_users.rb +0 -4
  341. data/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +0 -4
  342. data/spec/files/transaction_specified_migrations/002_create_basic.rb +0 -4
  343. data/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +0 -3
  344. data/spec/files/transaction_unspecified_migrations/002_create_basic.rb +0 -3
  345. data/spec/files/uppercase_timestamped_migrations/1273253849_CREATE_SESSIONS.RB +0 -9
  346. data/spec/files/uppercase_timestamped_migrations/1273253851_CREATE_NODES.RB +0 -9
  347. data/spec/files/uppercase_timestamped_migrations/1273253853_3_CREATE_USERS.RB +0 -4
  348. data/spec/guards_helper.rb +0 -59
  349. data/spec/integration/associations_test.rb +0 -2597
  350. data/spec/integration/database_test.rb +0 -113
  351. data/spec/integration/dataset_test.rb +0 -2037
  352. data/spec/integration/eager_loader_test.rb +0 -687
  353. data/spec/integration/migrator_test.rb +0 -262
  354. data/spec/integration/model_test.rb +0 -203
  355. data/spec/integration/plugin_test.rb +0 -2423
  356. data/spec/integration/prepared_statement_test.rb +0 -405
  357. data/spec/integration/schema_test.rb +0 -903
  358. data/spec/integration/spec_helper.rb +0 -71
  359. data/spec/integration/timezone_test.rb +0 -86
  360. data/spec/integration/transaction_test.rb +0 -603
  361. data/spec/integration/type_test.rb +0 -127
  362. data/spec/model/association_reflection_spec.rb +0 -803
  363. data/spec/model/associations_spec.rb +0 -4738
  364. data/spec/model/base_spec.rb +0 -875
  365. data/spec/model/class_dataset_methods_spec.rb +0 -146
  366. data/spec/model/dataset_methods_spec.rb +0 -198
  367. data/spec/model/eager_loading_spec.rb +0 -2377
  368. data/spec/model/hooks_spec.rb +0 -370
  369. data/spec/model/inflector_spec.rb +0 -26
  370. data/spec/model/model_spec.rb +0 -956
  371. data/spec/model/plugins_spec.rb +0 -429
  372. data/spec/model/record_spec.rb +0 -2118
  373. data/spec/model/spec_helper.rb +0 -46
  374. data/spec/model/validations_spec.rb +0 -220
  375. data/spec/model_no_assoc_spec.rb +0 -1
  376. data/spec/model_spec.rb +0 -1
  377. data/spec/plugin_spec.rb +0 -1
  378. data/spec/sequel_coverage.rb +0 -15
  379. data/spec/sequel_warning.rb +0 -4
  380. data/spec/spec_config.rb +0 -12
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2007-2008 Sharon Rosner
2
- Copyright (c) 2008-2019 Jeremy Evans
2
+ Copyright (c) 2008-2020 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
@@ -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,22 @@
1
+ = New Features
2
+
3
+ * An empty_failure_backtraces plugin has been added for using empty
4
+ backtraces for ValidationFailed and HookFailed exceptions. In many
5
+ cases, these exceptions are automatically handled (e.g. web form
6
+ submission handling to display appropriate error pages), and using
7
+ empty backtraces is 10-15x faster on JRuby 9.2.7.0+.
8
+
9
+ * Dataset#json_serializer_opts has been added to the json_serializer
10
+ plugin. This allows setting default options on a per-Dataset basis
11
+ for all Dataset#to_json calls.
12
+
13
+ = Other Improvements
14
+
15
+ * Another disconnect error is now recognized in the tinytds adapter.
16
+
17
+ * Using Sequel with the the CRuby master branch (what will be Ruby 3)
18
+ now works by supporting a second argument for
19
+ Dataset#initialize_clone.
20
+
21
+ * Sequel now avoids a warning in verbose mode when using the postgres
22
+ adapter, a recent version of ruby-pg, and bound variables.
@@ -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.