activestorage 6.1.6.1 → 6.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fb7344362927b3834f94b8e5cd2420f3c5060066804ccdedace833169d98bf1
4
- data.tar.gz: 0d3225047a9550eea6007f80b212ce28455795d55ecbfa0e902e480a048c7ceb
3
+ metadata.gz: c4f14b62a36e4ea3aa6a39126b4ca8b9f9e1316864d769d4e69b049be47c0c37
4
+ data.tar.gz: 0add8a6660b7c94ba0b86845ef1fdf657856cb7c7ec64e684e1ff760c9298c45
5
5
  SHA512:
6
- metadata.gz: 43a65bfab6574ff8f1b8d324da2d305baa99a871971814033fb232c60deaa7e2ed8348da24419e6f73ad13271c0eafcbaefde0598a1ed5cbff5bc8da0fdf3991
7
- data.tar.gz: 388a9c9628a15f9ac638a592cdbd527db9ab2d7bbb2e8d2492a8e987ea2744e3663e7dbaff18f80d780e199f5a8019d008e05843223cac8649fa9d8e33827cb2
6
+ metadata.gz: ad61f809370fb457cca4a07e4ffabe97bfd5a1a83901fb11d65da4473b748e4ba34238aca9aa0a40b658856a3e892824de709f57360d78a4c0b34295fc63836d
7
+ data.tar.gz: b76216dae6aa1f2844125a5a753b5ab7e008a07c4a027640766f2a03097f423267418b25ca2602027a547a107fc4107bd602ab4bdf2678e59731b4c571e309b8
data/CHANGELOG.md CHANGED
@@ -1,8 +1,19 @@
1
+ ## Rails 6.1.7 (September 09, 2022) ##
2
+
3
+ * Respect Active Record's primary_key_type in Active Storage migrations. Backported from 7.0.
4
+
5
+ *fatkodima*
6
+
1
7
  ## Rails 6.1.6.1 (July 12, 2022) ##
2
8
 
3
9
  * No changes.
4
10
 
5
11
 
12
+ ## Rails 6.1.6 (May 09, 2022) ##
13
+
14
+ * No changes.
15
+
16
+
6
17
  ## Rails 6.1.5.1 (April 26, 2022) ##
7
18
 
8
19
  * No changes.
@@ -1,6 +1,9 @@
1
1
  class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
2
2
  def change
3
- create_table :active_storage_blobs do |t|
3
+ # Use Active Record's configured type for primary and foreign keys
4
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
5
+
6
+ create_table :active_storage_blobs, id: primary_key_type do |t|
4
7
  t.string :key, null: false
5
8
  t.string :filename, null: false
6
9
  t.string :content_type
@@ -13,10 +16,10 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
13
16
  t.index [ :key ], unique: true
14
17
  end
15
18
 
16
- create_table :active_storage_attachments do |t|
19
+ create_table :active_storage_attachments, id: primary_key_type do |t|
17
20
  t.string :name, null: false
18
- t.references :record, null: false, polymorphic: true, index: false
19
- t.references :blob, null: false
21
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
22
+ t.references :blob, null: false, type: foreign_key_type
20
23
 
21
24
  t.datetime :created_at, null: false
22
25
 
@@ -24,12 +27,21 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
24
27
  t.foreign_key :active_storage_blobs, column: :blob_id
25
28
  end
26
29
 
27
- create_table :active_storage_variant_records do |t|
28
- t.belongs_to :blob, null: false, index: false
30
+ create_table :active_storage_variant_records, id: primary_key_type do |t|
31
+ t.belongs_to :blob, null: false, index: false, type: foreign_key_type
29
32
  t.string :variation_digest, null: false
30
33
 
31
34
  t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
32
35
  t.foreign_key :active_storage_blobs, column: :blob_id
33
36
  end
34
37
  end
38
+
39
+ private
40
+ def primary_and_foreign_key_types
41
+ config = Rails.configuration.generators
42
+ setting = config.options[config.orm][:primary_key_type]
43
+ primary_key_type = setting || :primary_key
44
+ foreign_key_type = setting || :bigint
45
+ [primary_key_type, foreign_key_type]
46
+ end
35
47
  end
@@ -1,5 +1,7 @@
1
1
  class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
2
2
  def up
3
+ return unless table_exists?(:active_storage_blobs)
4
+
3
5
  unless column_exists?(:active_storage_blobs, :service_name)
4
6
  add_column :active_storage_blobs, :service_name, :string
5
7
 
@@ -12,6 +14,8 @@ class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
12
14
  end
13
15
 
14
16
  def down
17
+ return unless table_exists?(:active_storage_blobs)
18
+
15
19
  remove_column :active_storage_blobs, :service_name
16
20
  end
17
21
  end
@@ -1,11 +1,26 @@
1
1
  class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
2
2
  def change
3
- create_table :active_storage_variant_records do |t|
4
- t.belongs_to :blob, null: false, index: false
3
+ return unless table_exists?(:active_storage_blobs)
4
+
5
+ # Use Active Record's configured type for primary key
6
+ create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
7
+ t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
5
8
  t.string :variation_digest, null: false
6
9
 
7
10
  t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
8
11
  t.foreign_key :active_storage_blobs, column: :blob_id
9
12
  end
10
13
  end
14
+
15
+ private
16
+ def primary_key_type
17
+ config = Rails.configuration.generators
18
+ config.options[config.orm][:primary_key_type] || :primary_key
19
+ end
20
+
21
+ def blobs_primary_key_type
22
+ pkey_name = connection.primary_key(:active_storage_blobs)
23
+ pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
24
+ pkey_column.bigint? ? :bigint : pkey_column.type
25
+ end
11
26
  end
@@ -9,8 +9,8 @@ module ActiveStorage
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 1
12
- TINY = 6
13
- PRE = "1"
12
+ TINY = 7
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.6.1
4
+ version: 6.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.1.6.1
19
+ version: 6.1.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.1.6.1
26
+ version: 6.1.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 6.1.6.1
33
+ version: 6.1.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 6.1.6.1
40
+ version: 6.1.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activejob
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 6.1.6.1
47
+ version: 6.1.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 6.1.6.1
54
+ version: 6.1.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activerecord
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 6.1.6.1
61
+ version: 6.1.7
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 6.1.6.1
68
+ version: 6.1.7
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: marcel
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -188,10 +188,10 @@ licenses:
188
188
  - MIT
189
189
  metadata:
190
190
  bug_tracker_uri: https://github.com/rails/rails/issues
191
- changelog_uri: https://github.com/rails/rails/blob/v6.1.6.1/activestorage/CHANGELOG.md
192
- documentation_uri: https://api.rubyonrails.org/v6.1.6.1/
191
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.7/activestorage/CHANGELOG.md
192
+ documentation_uri: https://api.rubyonrails.org/v6.1.7/
193
193
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
194
- source_code_uri: https://github.com/rails/rails/tree/v6.1.6.1/activestorage
194
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.7/activestorage
195
195
  rubygems_mfa_required: 'true'
196
196
  post_install_message:
197
197
  rdoc_options: []