sequel 5.28.0 → 5.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +64 -1922
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/doc/advanced_associations.rdoc +4 -4
- data/doc/association_basics.rdoc +3 -3
- data/doc/code_order.rdoc +12 -2
- data/doc/model_dataset_method_design.rdoc +1 -1
- data/doc/postgresql.rdoc +71 -0
- data/doc/release_notes/5.29.0.txt +22 -0
- data/doc/release_notes/5.30.0.txt +20 -0
- data/doc/release_notes/5.31.0.txt +148 -0
- data/doc/release_notes/5.32.0.txt +46 -0
- data/doc/release_notes/5.33.0.txt +24 -0
- data/doc/testing.rdoc +1 -1
- data/lib/sequel/adapters/postgres.rb +5 -1
- data/lib/sequel/adapters/shared/access.rb +6 -6
- data/lib/sequel/adapters/shared/mssql.rb +5 -5
- data/lib/sequel/adapters/shared/mysql.rb +10 -10
- data/lib/sequel/adapters/shared/oracle.rb +16 -16
- data/lib/sequel/adapters/shared/postgres.rb +169 -14
- data/lib/sequel/adapters/shared/sqlanywhere.rb +9 -9
- data/lib/sequel/adapters/shared/sqlite.rb +32 -5
- data/lib/sequel/adapters/tinytds.rb +1 -1
- data/lib/sequel/connection_pool/sharded_threaded.rb +2 -2
- data/lib/sequel/connection_pool/threaded.rb +1 -1
- data/lib/sequel/core.rb +318 -314
- data/lib/sequel/database/query.rb +1 -1
- data/lib/sequel/database/schema_generator.rb +1 -1
- data/lib/sequel/database/transactions.rb +8 -12
- data/lib/sequel/dataset/misc.rb +2 -2
- data/lib/sequel/extensions/connection_expiration.rb +2 -2
- data/lib/sequel/extensions/connection_validator.rb +2 -2
- data/lib/sequel/extensions/fiber_concurrency.rb +24 -0
- data/lib/sequel/extensions/index_caching.rb +9 -7
- data/lib/sequel/extensions/integer64.rb +2 -0
- data/lib/sequel/extensions/migration.rb +1 -1
- data/lib/sequel/extensions/pg_enum.rb +5 -2
- data/lib/sequel/extensions/pg_hstore.rb +6 -0
- data/lib/sequel/extensions/pg_inet.rb +13 -5
- data/lib/sequel/extensions/pg_interval.rb +2 -0
- data/lib/sequel/extensions/pg_range.rb +2 -0
- data/lib/sequel/extensions/pg_timestamptz.rb +2 -0
- data/lib/sequel/extensions/run_transaction_hooks.rb +72 -0
- data/lib/sequel/extensions/schema_dumper.rb +10 -4
- data/lib/sequel/extensions/server_block.rb +3 -3
- data/lib/sequel/model/associations.rb +18 -5
- data/lib/sequel/model/base.rb +60 -53
- data/lib/sequel/model/plugins.rb +1 -0
- data/lib/sequel/plugins/association_lazy_eager_option.rb +66 -0
- data/lib/sequel/plugins/association_multi_add_remove.rb +2 -0
- data/lib/sequel/plugins/association_proxies.rb +2 -0
- data/lib/sequel/plugins/boolean_subsets.rb +4 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +26 -26
- data/lib/sequel/plugins/dirty.rb +13 -13
- data/lib/sequel/plugins/empty_failure_backtraces.rb +38 -0
- data/lib/sequel/plugins/forbid_lazy_load.rb +214 -0
- data/lib/sequel/plugins/json_serializer.rb +18 -11
- data/lib/sequel/plugins/single_table_inheritance.rb +15 -15
- data/lib/sequel/plugins/skip_saving_columns.rb +108 -0
- data/lib/sequel/plugins/subclasses.rb +2 -0
- data/lib/sequel/plugins/throw_failures.rb +1 -1
- data/lib/sequel/timezones.rb +6 -4
- data/lib/sequel/version.rb +1 -1
- metadata +18 -367
- data/Rakefile +0 -151
- data/doc/release_notes/4.0.0.txt +0 -262
- data/doc/release_notes/4.1.0.txt +0 -85
- data/doc/release_notes/4.10.0.txt +0 -226
- data/doc/release_notes/4.11.0.txt +0 -147
- data/doc/release_notes/4.12.0.txt +0 -105
- data/doc/release_notes/4.13.0.txt +0 -169
- data/doc/release_notes/4.14.0.txt +0 -68
- data/doc/release_notes/4.15.0.txt +0 -56
- data/doc/release_notes/4.16.0.txt +0 -36
- data/doc/release_notes/4.17.0.txt +0 -38
- data/doc/release_notes/4.18.0.txt +0 -36
- data/doc/release_notes/4.19.0.txt +0 -45
- data/doc/release_notes/4.2.0.txt +0 -129
- data/doc/release_notes/4.20.0.txt +0 -79
- data/doc/release_notes/4.21.0.txt +0 -94
- data/doc/release_notes/4.22.0.txt +0 -72
- data/doc/release_notes/4.23.0.txt +0 -65
- data/doc/release_notes/4.24.0.txt +0 -99
- data/doc/release_notes/4.25.0.txt +0 -181
- data/doc/release_notes/4.26.0.txt +0 -44
- data/doc/release_notes/4.27.0.txt +0 -78
- data/doc/release_notes/4.28.0.txt +0 -57
- data/doc/release_notes/4.29.0.txt +0 -41
- data/doc/release_notes/4.3.0.txt +0 -40
- data/doc/release_notes/4.30.0.txt +0 -37
- data/doc/release_notes/4.31.0.txt +0 -57
- data/doc/release_notes/4.32.0.txt +0 -132
- data/doc/release_notes/4.33.0.txt +0 -88
- data/doc/release_notes/4.34.0.txt +0 -86
- data/doc/release_notes/4.35.0.txt +0 -130
- data/doc/release_notes/4.36.0.txt +0 -116
- data/doc/release_notes/4.37.0.txt +0 -50
- data/doc/release_notes/4.38.0.txt +0 -67
- data/doc/release_notes/4.39.0.txt +0 -127
- data/doc/release_notes/4.4.0.txt +0 -92
- data/doc/release_notes/4.40.0.txt +0 -179
- data/doc/release_notes/4.41.0.txt +0 -77
- data/doc/release_notes/4.42.0.txt +0 -221
- data/doc/release_notes/4.43.0.txt +0 -87
- data/doc/release_notes/4.44.0.txt +0 -125
- data/doc/release_notes/4.45.0.txt +0 -370
- data/doc/release_notes/4.46.0.txt +0 -404
- data/doc/release_notes/4.47.0.txt +0 -56
- data/doc/release_notes/4.48.0.txt +0 -293
- data/doc/release_notes/4.49.0.txt +0 -222
- data/doc/release_notes/4.5.0.txt +0 -34
- data/doc/release_notes/4.6.0.txt +0 -30
- data/doc/release_notes/4.7.0.txt +0 -103
- data/doc/release_notes/4.8.0.txt +0 -175
- data/doc/release_notes/4.9.0.txt +0 -190
- data/spec/adapter_spec.rb +0 -4
- data/spec/adapters/db2_spec.rb +0 -170
- data/spec/adapters/mssql_spec.rb +0 -828
- data/spec/adapters/mysql_spec.rb +0 -1060
- data/spec/adapters/oracle_spec.rb +0 -371
- data/spec/adapters/postgres_spec.rb +0 -4476
- data/spec/adapters/spec_helper.rb +0 -44
- data/spec/adapters/sqlanywhere_spec.rb +0 -97
- data/spec/adapters/sqlite_spec.rb +0 -652
- data/spec/bin_spec.rb +0 -278
- data/spec/core/connection_pool_spec.rb +0 -1250
- data/spec/core/database_spec.rb +0 -2915
- data/spec/core/dataset_spec.rb +0 -5547
- data/spec/core/deprecated_spec.rb +0 -70
- data/spec/core/expression_filters_spec.rb +0 -1498
- data/spec/core/mock_adapter_spec.rb +0 -722
- data/spec/core/object_graph_spec.rb +0 -336
- data/spec/core/placeholder_literalizer_spec.rb +0 -166
- data/spec/core/schema_generator_spec.rb +0 -214
- data/spec/core/schema_spec.rb +0 -1844
- data/spec/core/spec_helper.rb +0 -24
- data/spec/core/version_spec.rb +0 -14
- data/spec/core_extensions_spec.rb +0 -763
- data/spec/core_model_spec.rb +0 -2
- data/spec/core_spec.rb +0 -1
- data/spec/deprecation_helper.rb +0 -30
- data/spec/extensions/accessed_columns_spec.rb +0 -51
- data/spec/extensions/active_model_spec.rb +0 -99
- data/spec/extensions/after_initialize_spec.rb +0 -28
- data/spec/extensions/any_not_empty_spec.rb +0 -23
- data/spec/extensions/arbitrary_servers_spec.rb +0 -109
- data/spec/extensions/association_dependencies_spec.rb +0 -125
- data/spec/extensions/association_multi_add_remove_spec.rb +0 -1041
- data/spec/extensions/association_pks_spec.rb +0 -423
- data/spec/extensions/association_proxies_spec.rb +0 -100
- data/spec/extensions/auto_literal_strings_spec.rb +0 -205
- data/spec/extensions/auto_validations_spec.rb +0 -229
- data/spec/extensions/blacklist_security_spec.rb +0 -95
- data/spec/extensions/blank_spec.rb +0 -69
- data/spec/extensions/boolean_readers_spec.rb +0 -93
- data/spec/extensions/boolean_subsets_spec.rb +0 -47
- data/spec/extensions/caching_spec.rb +0 -273
- data/spec/extensions/caller_logging_spec.rb +0 -52
- data/spec/extensions/class_table_inheritance_spec.rb +0 -750
- data/spec/extensions/column_conflicts_spec.rb +0 -75
- data/spec/extensions/column_select_spec.rb +0 -129
- data/spec/extensions/columns_introspection_spec.rb +0 -90
- data/spec/extensions/columns_updated_spec.rb +0 -35
- data/spec/extensions/composition_spec.rb +0 -248
- data/spec/extensions/connection_expiration_spec.rb +0 -151
- data/spec/extensions/connection_validator_spec.rb +0 -144
- data/spec/extensions/constant_sql_override_spec.rb +0 -24
- data/spec/extensions/constraint_validations_plugin_spec.rb +0 -300
- data/spec/extensions/constraint_validations_spec.rb +0 -439
- data/spec/extensions/core_refinements_spec.rb +0 -528
- data/spec/extensions/csv_serializer_spec.rb +0 -183
- data/spec/extensions/current_datetime_timestamp_spec.rb +0 -27
- data/spec/extensions/dataset_associations_spec.rb +0 -365
- data/spec/extensions/dataset_source_alias_spec.rb +0 -51
- data/spec/extensions/date_arithmetic_spec.rb +0 -181
- data/spec/extensions/datetime_parse_to_time_spec.rb +0 -169
- data/spec/extensions/def_dataset_method_spec.rb +0 -100
- data/spec/extensions/defaults_setter_spec.rb +0 -150
- data/spec/extensions/delay_add_association_spec.rb +0 -73
- data/spec/extensions/dirty_spec.rb +0 -222
- data/spec/extensions/duplicate_columns_handler_spec.rb +0 -104
- data/spec/extensions/eager_each_spec.rb +0 -62
- data/spec/extensions/eager_graph_eager_spec.rb +0 -100
- data/spec/extensions/empty_array_consider_nulls_spec.rb +0 -24
- data/spec/extensions/error_splitter_spec.rb +0 -18
- data/spec/extensions/error_sql_spec.rb +0 -20
- data/spec/extensions/escaped_like_spec.rb +0 -40
- data/spec/extensions/eval_inspect_spec.rb +0 -81
- data/spec/extensions/exclude_or_null_spec.rb +0 -15
- data/spec/extensions/finder_spec.rb +0 -260
- data/spec/extensions/force_encoding_spec.rb +0 -126
- data/spec/extensions/freeze_datasets_spec.rb +0 -31
- data/spec/extensions/graph_each_spec.rb +0 -113
- data/spec/extensions/hook_class_methods_spec.rb +0 -402
- data/spec/extensions/identifier_mangling_spec.rb +0 -201
- data/spec/extensions/implicit_subquery_spec.rb +0 -58
- data/spec/extensions/index_caching_spec.rb +0 -66
- data/spec/extensions/inflector_spec.rb +0 -183
- data/spec/extensions/input_transformer_spec.rb +0 -69
- data/spec/extensions/insert_conflict_spec.rb +0 -103
- data/spec/extensions/insert_returning_select_spec.rb +0 -72
- data/spec/extensions/instance_filters_spec.rb +0 -79
- data/spec/extensions/instance_hooks_spec.rb +0 -246
- data/spec/extensions/integer64_spec.rb +0 -22
- data/spec/extensions/inverted_subsets_spec.rb +0 -33
- data/spec/extensions/json_serializer_spec.rb +0 -336
- data/spec/extensions/lazy_attributes_spec.rb +0 -183
- data/spec/extensions/list_spec.rb +0 -291
- data/spec/extensions/looser_typecasting_spec.rb +0 -43
- data/spec/extensions/many_through_many_spec.rb +0 -2177
- data/spec/extensions/migration_spec.rb +0 -864
- data/spec/extensions/modification_detection_spec.rb +0 -93
- data/spec/extensions/mssql_optimistic_locking_spec.rb +0 -92
- data/spec/extensions/named_timezones_spec.rb +0 -218
- data/spec/extensions/nested_attributes_spec.rb +0 -815
- data/spec/extensions/null_dataset_spec.rb +0 -85
- data/spec/extensions/optimistic_locking_spec.rb +0 -127
- data/spec/extensions/pagination_spec.rb +0 -116
- data/spec/extensions/pg_array_associations_spec.rb +0 -802
- data/spec/extensions/pg_array_ops_spec.rb +0 -144
- data/spec/extensions/pg_array_spec.rb +0 -398
- data/spec/extensions/pg_auto_constraint_validations_spec.rb +0 -209
- data/spec/extensions/pg_enum_spec.rb +0 -118
- data/spec/extensions/pg_extended_date_support_spec.rb +0 -126
- data/spec/extensions/pg_hstore_ops_spec.rb +0 -238
- data/spec/extensions/pg_hstore_spec.rb +0 -219
- data/spec/extensions/pg_inet_ops_spec.rb +0 -102
- data/spec/extensions/pg_inet_spec.rb +0 -72
- data/spec/extensions/pg_interval_spec.rb +0 -103
- data/spec/extensions/pg_json_ops_spec.rb +0 -356
- data/spec/extensions/pg_json_spec.rb +0 -451
- data/spec/extensions/pg_loose_count_spec.rb +0 -23
- data/spec/extensions/pg_range_ops_spec.rb +0 -60
- data/spec/extensions/pg_range_spec.rb +0 -600
- data/spec/extensions/pg_row_ops_spec.rb +0 -61
- data/spec/extensions/pg_row_plugin_spec.rb +0 -60
- data/spec/extensions/pg_row_spec.rb +0 -363
- data/spec/extensions/pg_static_cache_updater_spec.rb +0 -93
- data/spec/extensions/pg_timestamptz_spec.rb +0 -17
- data/spec/extensions/prepared_statements_safe_spec.rb +0 -66
- data/spec/extensions/prepared_statements_spec.rb +0 -177
- data/spec/extensions/pretty_table_spec.rb +0 -123
- data/spec/extensions/query_spec.rb +0 -94
- data/spec/extensions/rcte_tree_spec.rb +0 -387
- data/spec/extensions/round_timestamps_spec.rb +0 -39
- data/spec/extensions/s_spec.rb +0 -60
- data/spec/extensions/schema_caching_spec.rb +0 -64
- data/spec/extensions/schema_dumper_spec.rb +0 -870
- data/spec/extensions/select_remove_spec.rb +0 -38
- data/spec/extensions/sequel_4_dataset_methods_spec.rb +0 -121
- data/spec/extensions/serialization_modification_detection_spec.rb +0 -98
- data/spec/extensions/serialization_spec.rb +0 -365
- data/spec/extensions/server_block_spec.rb +0 -135
- data/spec/extensions/server_logging_spec.rb +0 -45
- data/spec/extensions/sharding_spec.rb +0 -197
- data/spec/extensions/shared_caching_spec.rb +0 -151
- data/spec/extensions/single_table_inheritance_spec.rb +0 -347
- data/spec/extensions/singular_table_names_spec.rb +0 -22
- data/spec/extensions/skip_create_refresh_spec.rb +0 -18
- data/spec/extensions/spec_helper.rb +0 -70
- data/spec/extensions/split_array_nil_spec.rb +0 -24
- data/spec/extensions/split_values_spec.rb +0 -57
- data/spec/extensions/sql_comments_spec.rb +0 -33
- data/spec/extensions/sql_expr_spec.rb +0 -59
- data/spec/extensions/static_cache_cache_spec.rb +0 -35
- data/spec/extensions/static_cache_spec.rb +0 -471
- data/spec/extensions/string_agg_spec.rb +0 -90
- data/spec/extensions/string_date_time_spec.rb +0 -95
- data/spec/extensions/string_stripper_spec.rb +0 -68
- data/spec/extensions/subclasses_spec.rb +0 -79
- data/spec/extensions/subset_conditions_spec.rb +0 -38
- data/spec/extensions/symbol_aref_refinement_spec.rb +0 -28
- data/spec/extensions/symbol_as_refinement_spec.rb +0 -21
- data/spec/extensions/synchronize_sql_spec.rb +0 -124
- data/spec/extensions/table_select_spec.rb +0 -83
- data/spec/extensions/tactical_eager_loading_spec.rb +0 -402
- data/spec/extensions/thread_local_timezones_spec.rb +0 -67
- data/spec/extensions/throw_failures_spec.rb +0 -74
- data/spec/extensions/timestamps_spec.rb +0 -209
- data/spec/extensions/to_dot_spec.rb +0 -153
- data/spec/extensions/touch_spec.rb +0 -226
- data/spec/extensions/tree_spec.rb +0 -334
- data/spec/extensions/typecast_on_load_spec.rb +0 -86
- data/spec/extensions/unlimited_update_spec.rb +0 -21
- data/spec/extensions/update_or_create_spec.rb +0 -83
- data/spec/extensions/update_primary_key_spec.rb +0 -105
- data/spec/extensions/update_refresh_spec.rb +0 -59
- data/spec/extensions/uuid_spec.rb +0 -101
- data/spec/extensions/validate_associated_spec.rb +0 -52
- data/spec/extensions/validation_class_methods_spec.rb +0 -1040
- data/spec/extensions/validation_contexts_spec.rb +0 -31
- data/spec/extensions/validation_helpers_spec.rb +0 -525
- data/spec/extensions/whitelist_security_spec.rb +0 -157
- data/spec/extensions/xml_serializer_spec.rb +0 -213
- data/spec/files/bad_down_migration/001_create_alt_basic.rb +0 -4
- data/spec/files/bad_down_migration/002_create_alt_advanced.rb +0 -4
- data/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +0 -9
- data/spec/files/bad_timestamped_migrations/1273253853_3_create_users.rb +0 -3
- data/spec/files/bad_up_migration/001_create_alt_basic.rb +0 -4
- data/spec/files/bad_up_migration/002_create_alt_advanced.rb +0 -3
- data/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +0 -9
- data/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +0 -9
- data/spec/files/convert_to_timestamp_migrations/003_3_create_users.rb +0 -4
- data/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +0 -9
- data/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +0 -9
- data/spec/files/double_migration/001_create_sessions.rb +0 -9
- data/spec/files/double_migration/002_create_nodes.rb +0 -19
- data/spec/files/double_migration/003_3_create_users.rb +0 -4
- data/spec/files/duplicate_integer_migrations/001_create_alt_advanced.rb +0 -4
- data/spec/files/duplicate_integer_migrations/001_create_alt_basic.rb +0 -4
- data/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +0 -9
- data/spec/files/duplicate_timestamped_migrations/1273253853_create_users.rb +0 -4
- data/spec/files/empty_migration/001_create_sessions.rb +0 -9
- data/spec/files/empty_migration/002_create_nodes.rb +0 -0
- data/spec/files/empty_migration/003_3_create_users.rb +0 -4
- data/spec/files/integer_migrations/001_create_sessions.rb +0 -9
- data/spec/files/integer_migrations/002_create_nodes.rb +0 -9
- data/spec/files/integer_migrations/003_3_create_users.rb +0 -4
- data/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +0 -9
- data/spec/files/interleaved_timestamped_migrations/1273253853_3_create_users.rb +0 -4
- data/spec/files/missing_integer_migrations/001_create_alt_basic.rb +0 -4
- data/spec/files/missing_integer_migrations/003_create_alt_advanced.rb +0 -4
- data/spec/files/missing_timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/missing_timestamped_migrations/1273253853_3_create_users.rb +0 -4
- data/spec/files/reversible_migrations/001_reversible.rb +0 -5
- data/spec/files/reversible_migrations/002_reversible.rb +0 -5
- data/spec/files/reversible_migrations/003_reversible.rb +0 -5
- data/spec/files/reversible_migrations/004_reversible.rb +0 -5
- data/spec/files/reversible_migrations/005_reversible.rb +0 -10
- data/spec/files/reversible_migrations/006_reversible.rb +0 -10
- data/spec/files/reversible_migrations/007_reversible.rb +0 -10
- data/spec/files/timestamped_migrations/1273253849_create_sessions.rb +0 -9
- data/spec/files/timestamped_migrations/1273253851_create_nodes.rb +0 -9
- data/spec/files/timestamped_migrations/1273253853_3_create_users.rb +0 -4
- data/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +0 -4
- data/spec/files/transaction_specified_migrations/002_create_basic.rb +0 -4
- data/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +0 -3
- data/spec/files/transaction_unspecified_migrations/002_create_basic.rb +0 -3
- data/spec/files/uppercase_timestamped_migrations/1273253849_CREATE_SESSIONS.RB +0 -9
- data/spec/files/uppercase_timestamped_migrations/1273253851_CREATE_NODES.RB +0 -9
- data/spec/files/uppercase_timestamped_migrations/1273253853_3_CREATE_USERS.RB +0 -4
- data/spec/guards_helper.rb +0 -59
- data/spec/integration/associations_test.rb +0 -2597
- data/spec/integration/database_test.rb +0 -113
- data/spec/integration/dataset_test.rb +0 -2037
- data/spec/integration/eager_loader_test.rb +0 -687
- data/spec/integration/migrator_test.rb +0 -262
- data/spec/integration/model_test.rb +0 -203
- data/spec/integration/plugin_test.rb +0 -2423
- data/spec/integration/prepared_statement_test.rb +0 -405
- data/spec/integration/schema_test.rb +0 -903
- data/spec/integration/spec_helper.rb +0 -71
- data/spec/integration/timezone_test.rb +0 -86
- data/spec/integration/transaction_test.rb +0 -603
- data/spec/integration/type_test.rb +0 -127
- data/spec/model/association_reflection_spec.rb +0 -803
- data/spec/model/associations_spec.rb +0 -4738
- data/spec/model/base_spec.rb +0 -875
- data/spec/model/class_dataset_methods_spec.rb +0 -146
- data/spec/model/dataset_methods_spec.rb +0 -198
- data/spec/model/eager_loading_spec.rb +0 -2377
- data/spec/model/hooks_spec.rb +0 -370
- data/spec/model/inflector_spec.rb +0 -26
- data/spec/model/model_spec.rb +0 -956
- data/spec/model/plugins_spec.rb +0 -429
- data/spec/model/record_spec.rb +0 -2118
- data/spec/model/spec_helper.rb +0 -46
- data/spec/model/validations_spec.rb +0 -220
- data/spec/model_no_assoc_spec.rb +0 -1
- data/spec/model_spec.rb +0 -1
- data/spec/plugin_spec.rb +0 -1
- data/spec/sequel_coverage.rb +0 -15
- data/spec/sequel_warning.rb +0 -4
- data/spec/spec_config.rb +0 -12
data/MIT-LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Copyright (c) 2007-2008 Sharon Rosner
|
2
|
-
Copyright (c) 2008-
|
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
|
data/README.rdoc
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
882
|
+
a sum cache using +after_create+, +after_update+, and +after_delete+ hooks, or preferably using a database trigger.
|
data/doc/association_basics.rdoc
CHANGED
@@ -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
|
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
|
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
|
1072
|
+
in addition to the :clone option.
|
1073
1073
|
|
1074
1074
|
==== :dataset
|
1075
1075
|
|
data/doc/code_order.rdoc
CHANGED
@@ -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
|
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
|
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
|
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.
|
data/doc/postgresql.rdoc
CHANGED
@@ -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.
|