verbose_migrations 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +53 -13
- data/lib/verbose_migrations/railtie.rb +8 -0
- data/lib/verbose_migrations/version.rb +1 -1
- data/lib/verbose_migrations.rb +23 -0
- metadata +50 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d2c1d35a9c0ebcba2ea106766e8ed501397b3c24941c5f54c74ca028bdfa776
|
4
|
+
data.tar.gz: 03ea6cc33ac78bbffc2b69c0908abe59798227dcb237a97705a957e859485e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 386bc10f3b9baba1a5468fc825105900223970127c6a62991fda5431cb588c614d5569dd5d78752bebe655848ee53687fd038f05b9b3feda891d4dde1bc5c436
|
7
|
+
data.tar.gz: f293b5b9faf86c3965cf0487144d53a54a533ca2921a740977a23aed44a66065895f4f134ff670594e493d3a536699b2d0c7319125a83bf3576c22e9bdcc8666
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,31 +1,71 @@
|
|
1
|
-
#
|
1
|
+
# verbose_migrations
|
2
2
|
|
3
|
-
|
3
|
+
[![CI](https://github.com/keygen-sh/verbose_migrations/actions/workflows/test.yml/badge.svg)](https://github.com/keygen-sh/verbose_migrations/actions)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/verbose_migrations.svg)](https://badge.fury.io/rb/verbose_migrations)
|
4
5
|
|
5
|
-
|
6
|
+
Enable verbose logging for Active Record migrations, regardless of configured
|
7
|
+
log level. Monitor query speed, query execution, and overall progress when
|
8
|
+
executing long running or otherwise risky migrations.
|
9
|
+
|
10
|
+
This gem was extracted from [Keygen](https://keygen.sh).
|
11
|
+
|
12
|
+
Sponsored by:
|
13
|
+
|
14
|
+
<a href="https://keygen.sh?ref=verbose_migrations">
|
15
|
+
<div>
|
16
|
+
<img src="https://keygen.sh/images/logo-pill.png" width="200" alt="Keygen">
|
17
|
+
</div>
|
18
|
+
</a>
|
19
|
+
|
20
|
+
_A fair source software licensing and distribution API._
|
6
21
|
|
7
22
|
## Installation
|
8
23
|
|
9
|
-
|
24
|
+
Add this line to your application's `Gemfile`:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'verbose_migrations'
|
28
|
+
```
|
10
29
|
|
11
|
-
|
30
|
+
And then execute:
|
12
31
|
|
13
|
-
|
32
|
+
```bash
|
33
|
+
$ bundle
|
34
|
+
```
|
14
35
|
|
15
|
-
|
36
|
+
Or install it yourself as:
|
16
37
|
|
17
|
-
|
38
|
+
```bash
|
39
|
+
$ gem install verbose_migrations
|
40
|
+
```
|
18
41
|
|
19
42
|
## Usage
|
20
43
|
|
21
|
-
|
44
|
+
```ruby
|
45
|
+
class SeedTagsFromPosts < ActiveRecord::Migration[7.1]
|
46
|
+
verbose!
|
22
47
|
|
23
|
-
|
48
|
+
def up
|
49
|
+
# ...
|
50
|
+
end
|
51
|
+
end
|
52
|
+
```
|
24
53
|
|
25
|
-
|
54
|
+
## Supported Rubies
|
26
55
|
|
27
|
-
|
56
|
+
**`verbose_migrations` supports Ruby 3.1 and above.** We encourage you to upgrade
|
57
|
+
if you're on an older version. Ruby 3 provides a lot of great features, like
|
58
|
+
better pattern matching and a new shorthand hash syntax.
|
59
|
+
|
60
|
+
## Is it any good?
|
61
|
+
|
62
|
+
Yes.
|
28
63
|
|
29
64
|
## Contributing
|
30
65
|
|
31
|
-
|
66
|
+
If you have an idea, or have discovered a bug, please open an issue or create a
|
67
|
+
pull request.
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/verbose_migrations.rb
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_record'
|
5
|
+
require 'logger'
|
6
|
+
|
3
7
|
require_relative 'verbose_migrations/version'
|
8
|
+
require_relative 'verbose_migrations/railtie'
|
4
9
|
|
5
10
|
module VerboseMigrations
|
11
|
+
module MigrationExtension
|
12
|
+
cattr_accessor :verbose_logger, default: nil
|
13
|
+
cattr_accessor :verbosity, default: nil
|
14
|
+
|
15
|
+
def verbose? = verbosity.present? && verbose_logger.present?
|
16
|
+
def verbose!(logger: ActiveRecord::Base.logger, level: Logger::DEBUG)
|
17
|
+
self.verbose_logger = logger
|
18
|
+
self.verbosity = level
|
19
|
+
end
|
20
|
+
|
21
|
+
def migrate(...)
|
22
|
+
verbosity_was, verbose_logger.level = verbose_logger.level, verbosity if verbose?
|
23
|
+
|
24
|
+
super
|
25
|
+
ensure
|
26
|
+
verbose_logger.level = verbosity_was if verbose?
|
27
|
+
end
|
28
|
+
end
|
6
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verbose_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeke Gabrielse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,9 +38,51 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: transition_through
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: prism
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Enable verbose logging for Active Record migrations, regardless of configured
|
84
|
+
log level. Monitor query speed, query execution, and overall progress when executing
|
85
|
+
long running or otherwise risky migrations.
|
44
86
|
email:
|
45
87
|
- oss@keygen.sh
|
46
88
|
executables: []
|
@@ -53,6 +95,7 @@ files:
|
|
53
95
|
- README.md
|
54
96
|
- SECURITY.md
|
55
97
|
- lib/verbose_migrations.rb
|
98
|
+
- lib/verbose_migrations/railtie.rb
|
56
99
|
- lib/verbose_migrations/version.rb
|
57
100
|
homepage: https://github.com/keygen-sh/verbose_migrations
|
58
101
|
licenses:
|
@@ -76,5 +119,6 @@ requirements: []
|
|
76
119
|
rubygems_version: 3.4.13
|
77
120
|
signing_key:
|
78
121
|
specification_version: 4
|
79
|
-
summary:
|
122
|
+
summary: Enable verbose logging for Active Record migrations, regardless of configured
|
123
|
+
log level, to monitor query speed and execution.
|
80
124
|
test_files: []
|