active_storage_db 1.1.2 → 1.2.0

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: 33872893aefc8f1086a8c422819990e10d1d46d2b97bd87d67662fd153536243
4
- data.tar.gz: 0e662cd62a06ec353c9e02706c1c553500edafa146e4149d21fa57626d129d5a
3
+ metadata.gz: 1a465e1b93b8ab6436f800b2a0ff6e38f049fae621587924d9b2299f3fa06946
4
+ data.tar.gz: 78583f7c6aa00b0a8c7ab1d98f05d4d34e8ff8a1846f0ed70a0c3e16e97275c7
5
5
  SHA512:
6
- metadata.gz: a418655f7275cc54264b25733712cbe813eeede79eb7d08833c2e333427d7a9c1cb44f1c46b3a338cf20407abf0d7d9b59e2dfcdec0f1467b77f47ca85b7357e
7
- data.tar.gz: ac8d6c3c8fc9c44177d474c709f67ff5a46a8c1835c15e9f753773ac846851e23bd13ef2e8e0c3fd13185ea0d8f528f31aac8ae48275a46288bde22a6ad04dee
6
+ metadata.gz: 76ef220615b3e3704a99803a8bbe3af211855278d3532a97bbc9f325a5455ff393dde657180368d10bdecce8592afe99a41be7f6fe28e325d3671fa3b414087a
7
+ data.tar.gz: c555f306068194447e708c743abdc829f8043728585da32bbf504d689571d38a72725dbe97382665bd20fdaa95848b48ee018d45ab5d22692c1736ad9bcc59cb
data/README.md CHANGED
@@ -5,15 +5,15 @@
5
5
  [![maintainability](https://api.codeclimate.com/v1/badges/92e1e703c308744a0f66/maintainability)](https://codeclimate.com/github/blocknotes/active_storage_db/maintainability)
6
6
 
7
7
  [![linters](https://github.com/blocknotes/active_storage_db/actions/workflows/linters.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/linters.yml)
8
- [![specs Postgres](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_70.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_70.yml)
9
- [![Specs MySQL](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_70.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_70.yml)
8
+ [![specs Postgres](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml)
9
+ [![specs MySQL](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml)
10
10
 
11
11
  An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database.
12
12
 
13
13
  Main features:
14
- - supports Rails _6.0_, _6.1_ and _7.0_;
14
+ - attachment data stored in a binary field (or blob);
15
15
  - all service methods implemented;
16
- - attachment data stored in a binary field (or blob).
16
+ - supports Rails _6_ and _7_.
17
17
 
18
18
  Useful also with platforms like Heroku (due to their ephemeral file system).
19
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageDB
4
- VERSION = '1.1.2'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -20,7 +20,7 @@ namespace :asdb do
20
20
  desc 'ActiveStorageDB: list attachments ordered by blob id desc'
21
21
  task list: [:environment] do |_t, _args|
22
22
  query = ::ActiveStorage::Blob.order(id: :desc).limit(100)
23
- digits = Math.log(query.maximum(:id), 10).to_i + 1
23
+ digits = query.ids.inject(0) { |ret, id| size = id.to_s.size; [size, ret].max }
24
24
 
25
25
  ::ActiveStorage::Tasks.print_blob_header(digits: digits)
26
26
  query.each do |blob|
@@ -52,7 +52,7 @@ namespace :asdb do
52
52
 
53
53
  blobs = ::ActiveStorage::Blob.where('filename LIKE ?', "%#{filename}%").order(id: :desc)
54
54
  if blobs.any?
55
- digits = Math.log(blobs.first.id, 10).to_i + 1
55
+ digits = blobs.ids.inject(0) { |ret, id| size = id.to_s.size; [size, ret].max }
56
56
  ::ActiveStorage::Tasks.print_blob_header(digits: digits)
57
57
  blobs.each do |blob|
58
58
  ::ActiveStorage::Tasks.print_blob(blob, digits: digits)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-07 00:00:00.000000000 Z
11
+ date: 2023-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage
@@ -105,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 2.6.0
108
+ version: 2.7.0
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.1.6
115
+ rubygems_version: 3.4.19
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: ActiveStorage DB Service