prodder 1.8.2 → 1.8.3
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/.github/workflows/ci.yml +8 -10
- data/.gitignore +1 -0
- data/LICENSE.txt +5 -7
- data/README.md +9 -5
- data/lib/prodder/prodder.rake +9 -9
- data/lib/prodder/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7709fb16a2203aee7eee5e75771b3439c5d086490e74fb8be8f5327eb21540ce
|
4
|
+
data.tar.gz: a9d397b82cfb40165459ee7a02b221a1cbc43a50e7ad70d6787b0057f61221b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31168254cb004ace7e020bfd8957b4e6a6a8d50432706b6eef7f1ab32bfaa6d85912fecb855129fc03dacab34175986d05e45ed8a26d00773715ce4f47f2f7b9
|
7
|
+
data.tar.gz: 863da359bccf237b5479a6bca29446751841d96469ec68040a10722390ab88d33430b49035f8bcda18baef85981522fdffd8a1307724a87bd027d40d20b8127b
|
data/.github/workflows/ci.yml
CHANGED
@@ -5,9 +5,7 @@ on:
|
|
5
5
|
push:
|
6
6
|
branches:
|
7
7
|
- main
|
8
|
-
|
9
|
-
branches:
|
10
|
-
- main
|
8
|
+
pull_request:
|
11
9
|
|
12
10
|
permissions:
|
13
11
|
contents: read
|
@@ -60,10 +58,10 @@ jobs:
|
|
60
58
|
PGUSER: postgres
|
61
59
|
PGPASSWORD: postgres
|
62
60
|
run: bundle exec rspec
|
63
|
-
- name: Test with Cucumber
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
61
|
+
# - name: Test with Cucumber
|
62
|
+
# env:
|
63
|
+
# PGHOST: localhost
|
64
|
+
# PGPORT: 5432
|
65
|
+
# PGUSER: postgres
|
66
|
+
# PGPASSWORD: postgres
|
67
|
+
# run: bundle exec cucumber
|
data/.gitignore
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Copyright (c) 2016 Enova
|
1
|
+
Copyright (c) 2025 Enova International
|
4
2
|
|
5
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
4
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
7
|
copies of the Software, and to permit persons to whom the Software is
|
10
8
|
furnished to do so, subject to the following conditions:
|
11
9
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
14
12
|
|
15
13
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
14
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
15
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
16
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
17
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
=======
|
2
|
+
# Prodder
|
4
3
|
|
5
4
|
A tool to maintain and load your Rails application's database structure, seed
|
6
5
|
table contents, permissions and database settings based on its migration history
|
@@ -29,6 +28,7 @@ prior to enforcing foreign key constraints and if you want to develop in an envi
|
|
29
28
|
with the same permissions setup as production.
|
30
29
|
|
31
30
|
### Installation
|
31
|
+
|
32
32
|
In your Gemfile:
|
33
33
|
|
34
34
|
```ruby
|
@@ -74,6 +74,7 @@ bundle exec rake db:reset db:migrate
|
|
74
74
|
```
|
75
75
|
|
76
76
|
### Usage
|
77
|
+
|
77
78
|
Things that really matter:
|
78
79
|
|
79
80
|
1. `rake db:reset` recreates your database, loading `db/structure.sql`, `db/seeds.sql`,
|
@@ -205,6 +206,7 @@ store:
|
|
205
206
|
```
|
206
207
|
|
207
208
|
### Quality Checks
|
209
|
+
|
208
210
|
In some cases, such as foreign key dependencies and triggers, you may wish to defer
|
209
211
|
loading constraints on your tables until _after_ your seed data has been loaded.
|
210
212
|
`prodder` treats the presence of a `quality_check_file` key in the configuration
|
@@ -212,6 +214,7 @@ as an indication that it should split `structure_file` into those statements whi
|
|
212
214
|
create the base structure, and put the constraints into the `quality_check_file`.
|
213
215
|
|
214
216
|
### Permissions
|
217
|
+
|
215
218
|
We have had multiple cases in the past with deployments failing because some role
|
216
219
|
cannot access something on prod. To fail early and catch these in development, it
|
217
220
|
would be easier to just have these permissions loaded in development environments.
|
@@ -221,10 +224,9 @@ must configure the 3 users as mentioned before in `#config/database.yml`.
|
|
221
224
|
```yaml
|
222
225
|
store:
|
223
226
|
structure_file: db/structure.sql # CREATE TABLE ...
|
224
|
-
quality_check_file: db/
|
227
|
+
quality_check_file: db/quality_checks.sql # ALTER TABLE ... ADD FOREIGN KEY ...
|
225
228
|
```
|
226
229
|
|
227
|
-
|
228
230
|
### Example usage
|
229
231
|
|
230
232
|
The `-c` option to specify the configuration file is always required. All
|
@@ -254,12 +256,14 @@ $ prodder push -c prodder.yml
|
|
254
256
|
```
|
255
257
|
|
256
258
|
## TODO
|
259
|
+
|
257
260
|
* Log activity as it is performed.
|
258
261
|
* Support tracking a particular branch instead of master.
|
259
262
|
* Support specifying the options to pass to each pg_dump form.
|
260
263
|
* Select dumping only a subset of a seed table. (pg_dump won't do this ...)
|
261
264
|
|
262
265
|
## Previous Contributors
|
266
|
+
|
263
267
|
* [Kyle Hargraves](https://github.com/pd)
|
264
268
|
* [Sri Rangarajan](https://github.com/Slania)
|
265
269
|
* [Emmanuel Sambo](https://github.com/esambo)
|
@@ -269,4 +273,4 @@ $ prodder push -c prodder.yml
|
|
269
273
|
|
270
274
|
## License
|
271
275
|
|
272
|
-
The gem is available as open source under the terms of the [MIT License](
|
276
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|
data/lib/prodder/prodder.rake
CHANGED
@@ -169,7 +169,7 @@ namespace :db do
|
|
169
169
|
end
|
170
170
|
as("superuser", in: environments) do
|
171
171
|
ActiveRecord::Tasks::DatabaseTasks.create_current
|
172
|
-
|
172
|
+
Rails.configuration.database_configuration.each do |env, config|
|
173
173
|
if environments.include?(env) && config["migration_user"] && config['database']
|
174
174
|
set_psql_env config
|
175
175
|
`psql --no-psqlrc --command "ALTER DATABASE #{config['database']} OWNER TO #{config['migration_user']}" #{Shellwords.escape(config['database'])}`
|
@@ -182,7 +182,7 @@ namespace :db do
|
|
182
182
|
task :all => dependencies do
|
183
183
|
as("superuser") do
|
184
184
|
ActiveRecord::Tasks::DatabaseTasks.create_all
|
185
|
-
|
185
|
+
Rails.configuration.database_configuration.each do |env, config|
|
186
186
|
if config["migration_user"] && config['database']
|
187
187
|
set_psql_env config
|
188
188
|
`psql --no-psqlrc --command "ALTER DATABASE #{config['database']} OWNER TO #{config['migration_user']}" #{Shellwords.escape(config['database'])}`
|
@@ -362,19 +362,19 @@ namespace :db do
|
|
362
362
|
|
363
363
|
def as(user, opts = {}, &block)
|
364
364
|
if File.exist?('db/permissions.sql')
|
365
|
-
|
366
|
-
in_env = Array(opts[:in]) ||
|
367
|
-
|
368
|
-
|
369
|
-
config =
|
370
|
-
|
365
|
+
config, config_was = Rails.configuration.database_configuration, ActiveRecord::Base.configurations.deep_dup
|
366
|
+
in_env = Array(opts[:in]) || config.keys
|
367
|
+
if config.all? { |env, config_hash| in_env.include?(env) ? config_hash[user] : true }
|
368
|
+
disconnect
|
369
|
+
config.each { |env, config_hash| config_hash["username"] = config_hash[user] if in_env.include?(env) }
|
370
|
+
ActiveRecord::Base.configurations = config
|
371
371
|
end
|
372
372
|
else
|
373
373
|
puts "No permissions file (db/permissions.sql) found, running everything in context of user"
|
374
374
|
end
|
375
375
|
yield
|
376
376
|
ensure
|
377
|
-
ActiveRecord::Base.configurations =
|
377
|
+
ActiveRecord::Base.configurations = config_was if config_was
|
378
378
|
in_env.each { |env| ActiveRecord::Base.establish_connection(env.intern) } if in_env
|
379
379
|
end
|
380
380
|
|
data/lib/prodder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prodder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Hargraves
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-07-25 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: deject
|
@@ -70,7 +69,6 @@ homepage: https://github.com/enova/prodder
|
|
70
69
|
licenses:
|
71
70
|
- MIT
|
72
71
|
metadata: {}
|
73
|
-
post_install_message:
|
74
72
|
rdoc_options: []
|
75
73
|
require_paths:
|
76
74
|
- lib
|
@@ -85,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
83
|
- !ruby/object:Gem::Version
|
86
84
|
version: '0'
|
87
85
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
89
|
-
signing_key:
|
86
|
+
rubygems_version: 3.6.2
|
90
87
|
specification_version: 4
|
91
88
|
summary: Maintain your Rails apps' structure, seed and quality_checks files using
|
92
89
|
production dumps
|