after_migrate 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/after_migrate/version.rb +1 -1
- data/lib/after_migrate.rb +63 -14
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52bea11a45a6765c9bff5e82d42d527595e7ef6c91e84028ca2dde978d8d527e
|
|
4
|
+
data.tar.gz: 3dcd46239d300faa855998e427585870899a0ea0d013e21fb6eb770ecd5f5be4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e21f8c6f9db4d2db100b5ef4c93f87ce0a7b69af5a7da29b79ce91a4a47e585ffdce9f33726929aed3962693ad9afee40418a40dc76a813dc2ee717b5333a59d
|
|
7
|
+
data.tar.gz: d6da80e272cc1895bb753b6fa01b423fc8eb9c3ea4f93d34d691f64743d1269689c3147764d953114957907d36fea5cac8910b03baac009fea08984924c4154b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.4] - 2026-06-01
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- `config.store_options` for store-specific settings, e.g. `config.store_options_for(:redis)[:client]`
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Store-specific configuration now flows through `config.store_options` while preserving compatibility accessors such as `config.store_path`, `config.redis`, `config.redis_key_prefix`, and `config.redis_ttl`
|
|
12
|
+
- `config.run_id` now defaults from `AFTER_MIGRATE_RUN_ID`, falling back to `default`
|
|
13
|
+
|
|
5
14
|
## [0.2.3] - 2026-06-01
|
|
6
15
|
|
|
7
16
|
### Added
|
data/lib/after_migrate.rb
CHANGED
|
@@ -9,7 +9,7 @@ require 'after_migrate/railtie'
|
|
|
9
9
|
module AfterMigrate
|
|
10
10
|
class Configuration
|
|
11
11
|
attr_accessor :enabled, :verbose, :vacuum, :analyze, :rake_tasks_enhanced, :defer,
|
|
12
|
-
:store, :
|
|
12
|
+
:store, :run_id, :store_options
|
|
13
13
|
|
|
14
14
|
def initialize
|
|
15
15
|
@enabled = true
|
|
@@ -19,11 +19,53 @@ module AfterMigrate
|
|
|
19
19
|
@rake_tasks_enhanced = true
|
|
20
20
|
@defer = true
|
|
21
21
|
@store = :memory
|
|
22
|
-
@
|
|
23
|
-
@
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
@run_id = ENV.fetch('AFTER_MIGRATE_RUN_ID', 'default')
|
|
23
|
+
@store_options = {
|
|
24
|
+
file: {
|
|
25
|
+
path: 'tmp/after_migrate/affected_tables.json'
|
|
26
|
+
},
|
|
27
|
+
redis: {
|
|
28
|
+
client: nil,
|
|
29
|
+
key_prefix: 'after_migrate',
|
|
30
|
+
ttl: 24 * 60 * 60
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def store_path
|
|
36
|
+
store_options_for(:file)[:path]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def store_path=(value)
|
|
40
|
+
store_options_for(:file)[:path] = value
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def redis
|
|
44
|
+
store_options_for(:redis)[:client]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def redis=(value)
|
|
48
|
+
store_options_for(:redis)[:client] = value
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def redis_key_prefix
|
|
52
|
+
store_options_for(:redis)[:key_prefix]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def redis_key_prefix=(value)
|
|
56
|
+
store_options_for(:redis)[:key_prefix] = value
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def redis_ttl
|
|
60
|
+
store_options_for(:redis)[:ttl]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def redis_ttl=(value)
|
|
64
|
+
store_options_for(:redis)[:ttl] = value
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def store_options_for(store_name)
|
|
68
|
+
store_options[store_name.to_sym] ||= {}
|
|
27
69
|
end
|
|
28
70
|
end
|
|
29
71
|
|
|
@@ -72,17 +114,15 @@ module AfterMigrate
|
|
|
72
114
|
def store_key
|
|
73
115
|
[
|
|
74
116
|
configuration.store.to_s,
|
|
75
|
-
configuration.store_path.to_s,
|
|
76
117
|
configuration.run_id.to_s,
|
|
77
|
-
configuration.
|
|
78
|
-
configuration.redis_ttl.to_s
|
|
118
|
+
configuration.store_options_for(configuration.store).hash
|
|
79
119
|
]
|
|
80
120
|
end
|
|
81
121
|
|
|
82
122
|
def build_store
|
|
83
123
|
case configuration.store.to_s
|
|
84
124
|
when 'file'
|
|
85
|
-
|
|
125
|
+
file_store
|
|
86
126
|
when 'redis'
|
|
87
127
|
redis_store
|
|
88
128
|
else
|
|
@@ -90,12 +130,21 @@ module AfterMigrate
|
|
|
90
130
|
end
|
|
91
131
|
end
|
|
92
132
|
|
|
133
|
+
def file_store
|
|
134
|
+
options = configuration.store_options_for(:file)
|
|
135
|
+
Stores::FileStore.new(
|
|
136
|
+
path: options.fetch(:path),
|
|
137
|
+
run_id: options.fetch(:run_id, configuration.run_id)
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
93
141
|
def redis_store
|
|
142
|
+
options = configuration.store_options_for(:redis)
|
|
94
143
|
Stores::RedisStore.new(
|
|
95
|
-
redis:
|
|
96
|
-
key_prefix:
|
|
97
|
-
run_id: configuration.run_id,
|
|
98
|
-
ttl:
|
|
144
|
+
redis: options[:client],
|
|
145
|
+
key_prefix: options.fetch(:key_prefix),
|
|
146
|
+
run_id: options.fetch(:run_id, configuration.run_id),
|
|
147
|
+
ttl: options.fetch(:ttl)
|
|
99
148
|
)
|
|
100
149
|
end
|
|
101
150
|
end
|