activerecord 7.1.0.beta1 → 7.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +70 -4
  3. data/lib/active_record/associations/collection_association.rb +1 -3
  4. data/lib/active_record/associations/collection_proxy.rb +1 -1
  5. data/lib/active_record/associations.rb +107 -107
  6. data/lib/active_record/connection_adapters/abstract/database_statements.rb +20 -1
  7. data/lib/active_record/connection_adapters/abstract/schema_creation.rb +3 -3
  8. data/lib/active_record/connection_adapters/abstract/transaction.rb +12 -9
  9. data/lib/active_record/connection_adapters/abstract_adapter.rb +1 -1
  10. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +7 -0
  11. data/lib/active_record/connection_adapters/mysql/schema_statements.rb +1 -1
  12. data/lib/active_record/connection_adapters/pool_manager.rb +1 -1
  13. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +0 -16
  14. data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +5 -5
  15. data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +24 -24
  16. data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +19 -8
  17. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +25 -29
  18. data/lib/active_record/connection_adapters/postgresql_adapter.rb +1 -6
  19. data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +4 -4
  20. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +49 -4
  21. data/lib/active_record/core.rb +7 -9
  22. data/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb +1 -1
  23. data/lib/active_record/errors.rb +19 -0
  24. data/lib/active_record/gem_version.rb +1 -1
  25. data/lib/active_record/migration/command_recorder.rb +8 -8
  26. data/lib/active_record/normalization.rb +2 -1
  27. data/lib/active_record/railtie.rb +1 -1
  28. data/lib/active_record/reflection.rb +10 -16
  29. data/lib/active_record/relation/finder_methods.rb +3 -12
  30. data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +4 -6
  31. data/lib/active_record/schema_dumper.rb +9 -4
  32. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c0f9a1eb226b8940b447066c71c2faee79bc3f6e96e36acddd10a7108a64643
4
- data.tar.gz: 2be091ed3458d0ae9b2cdd12b71f1212ab3be9154b929cb473e0d21aed91d3d5
3
+ metadata.gz: 740af6b88b6b54646450a59ad5dfa1b03ca0848f6a0e35d144c0501450c95813
4
+ data.tar.gz: 116d5b18e58370804b0888cd01443af9c0d3d760f9ef8c6f0374572e592c1396
5
5
  SHA512:
6
- metadata.gz: c2aaf3118a53a3d80ac95407cbb46c4a929824f1e76645f1d10be2e56b40b5b24a8a8d9085f33d94aaf20c26e7a0ff6b65ded854d7c0eea6643e19d78e006444
7
- data.tar.gz: 49b247c619c3c9056d0cb748dc63aec82990246dcecf0a623598e4cdad792c039eded0a9a8026a5182ec2cab74cef3295eff38ac222318ef3b1a391f8e0460df
6
+ metadata.gz: 4f6fd78b9fcd2d861501a1fb76e1c0575da14b158de781ef466c0568b1b3842efcf8213128a95e71cb8414e1ea5bc617850eb19cb30a05e45f5239633fa5023e
7
+ data.tar.gz: ed6ccf8f8470fba640ea0a18ccf2c2e5c62cabcd0a21cd9635acd2a9f1db63b22dd4fbd13d2474a020182f703ed3b0e9a11d34389654ae2fb6b7da23deab25f2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,69 @@
1
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
2
+
3
+ * Better naming for unique constraints support.
4
+
5
+ Naming unique keys leads to misunderstanding it's a short-hand of unique indexes.
6
+ Just naming it unique constraints is not misleading.
7
+
8
+ In Rails 7.1.0.beta1 or before:
9
+
10
+ ```ruby
11
+ add_unique_key :sections, [:position], deferrable: :deferred, name: "unique_section_position"
12
+ remove_unique_key :sections, name: "unique_section_position"
13
+ ```
14
+
15
+ Now:
16
+
17
+ ```ruby
18
+ add_unique_constraint :sections, [:position], deferrable: :deferred, name: "unique_section_position"
19
+ remove_unique_constraint :sections, name: "unique_section_position"
20
+ ```
21
+
22
+ *Ryuta Kamizono*
23
+
24
+ * Fix duplicate quoting for check constraint expressions in schema dump when using MySQL
25
+
26
+ A check constraint with an expression, that already contains quotes, lead to an invalid schema
27
+ dump with the mysql2 adapter.
28
+
29
+ Fixes #42424.
30
+
31
+ *Felix Tscheulin*
32
+
33
+ * Performance tune the SQLite3 adapter connection configuration
34
+
35
+ For Rails applications, the Write-Ahead-Log in normal syncing mode with a capped journal size, a healthy shared memory buffer and a shared cache will perform, on average, 2× better.
36
+
37
+ *Stephen Margheim*
38
+
39
+ * Allow SQLite3 `busy_handler` to be configured with simple max number of `retries`
40
+
41
+ Retrying busy connections without delay is a preferred practice for performance-sensitive applications. Add support for a `database.yml` `retries` integer, which is used in a simple `busy_handler` function to retry busy connections without exponential backoff up to the max number of `retries`.
42
+
43
+ *Stephen Margheim*
44
+
45
+ * The SQLite3 adapter now supports `supports_insert_returning?`
46
+
47
+ Implementing the full `supports_insert_returning?` contract means the SQLite3 adapter supports auto-populated columns (#48241) as well as custom primary keys.
48
+
49
+ *Stephen Margheim*
50
+
51
+ * Ensure the SQLite3 adapter handles default functions with the `||` concatenation operator
52
+
53
+ Previously, this default function would produce the static string `"'Ruby ' || 'on ' || 'Rails'"`.
54
+ Now, the adapter will appropriately receive and use `"Ruby on Rails"`.
55
+
56
+ ```ruby
57
+ change_column_default "test_models", "ruby_on_rails", -> { "('Ruby ' || 'on ' || 'Rails')" }
58
+ ```
59
+
60
+ *Stephen Margheim*
61
+
62
+ * Dump PostgreSQL schemas as part of the schema dump.
63
+
64
+ *Lachlan Sylvester*
65
+
66
+
1
67
  ## Rails 7.1.0.beta1 (September 13, 2023) ##
2
68
 
3
69
  * Encryption now supports `support_unencrypted_data` being set per-attribute.
@@ -16,7 +82,7 @@
16
82
 
17
83
  * Add instrumentation for Active Record transactions
18
84
 
19
- Allows subscribing to transaction events for tracking/instrumentation. The event payload contains the connection, as well as timing details.
85
+ Allows subscribing to transaction events for tracking/instrumentation. The event payload contains the connection and the outcome (commit, rollback, restart, incomplete), as well as timing details.
20
86
 
21
87
  ```ruby
22
88
  ActiveSupport::Notifications.subscribe("transaction.active_record") do |event|
@@ -601,7 +667,7 @@
601
667
 
602
668
  # Topic => Topic(id: integer, title: string, author_name: string...)
603
669
 
604
- Topic.where([:title, :author_name] => [["The Alchemist", "Paul Coelho"], ["Harry Potter", "J.K Rowling"]])
670
+ Topic.where([:title, :author_name] => [["The Alchemist", "Paulo Coelho"], ["Harry Potter", "J.K Rowling"]])
605
671
  ```
606
672
 
607
673
  *Paarth Madan*
@@ -852,7 +918,7 @@
852
918
 
853
919
  *Jean Boussier*
854
920
 
855
- * YAML columns use `YAML.safe_dump` is available.
921
+ * YAML columns use `YAML.safe_dump` if available.
856
922
 
857
923
  As of `psych 5.1.0`, `YAML.safe_dump` can now apply the same permitted
858
924
  types restrictions than `YAML.safe_load`.
@@ -1354,7 +1420,7 @@
1354
1420
 
1355
1421
  *Adrianna Chang*
1356
1422
 
1357
- * Add `expires_in` option to `signed_id`.
1423
+ * Add `expires_at` option to `signed_id`.
1358
1424
 
1359
1425
  *Shouichi Kamiya*
1360
1426
 
@@ -64,9 +64,7 @@ module ActiveRecord
64
64
  ids.map! { |id| pk_type.cast(id) }
65
65
 
66
66
  records = if klass.composite_primary_key?
67
- query_records = ids.map { |values_set| klass.where(primary_key.zip(values_set).to_h) }.inject(&:or)
68
-
69
- query_records.index_by do |record|
67
+ klass.where(primary_key => ids).index_by do |record|
70
68
  primary_key.map { |primary_key| record._read_attribute(primary_key) }
71
69
  end
72
70
  else
@@ -361,7 +361,7 @@ module ActiveRecord
361
361
  # end
362
362
  #
363
363
  # person.pets.create!(name: nil)
364
- # # => ActiveRecord::RecordInvalid: Validation failed: Name cant be blank
364
+ # # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
365
365
  def create!(attributes = {}, &block)
366
366
  @association.create!(attributes, &block)
367
367
  end