nonschema_migrations 6.5.1 → 6.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2e935824796ce13a066ffb1ae249e290b68fa98a0795b1b6030c5c29317d343
4
- data.tar.gz: 6e0570efd5a054f192dcd231b66b05b241e56b9f03e46ede56f2322416c5f501
3
+ metadata.gz: 2055d637016ed0b01c1c901075a76a11beb228a0101713df81a72046caddbbaf
4
+ data.tar.gz: 1b073ed19a21a7d96f54319655c3db6bce264d892b65e922615f29261a9c8d82
5
5
  SHA512:
6
- metadata.gz: 2d8f77a424fd97f377ea19cdb52b2ce8c9633452139c2e9102d9b6345195fa6e5ae25a78eb5753f4a23fd9ba847897caf8ac9cefd19cee6003dfac7b03d45c80
7
- data.tar.gz: 346ee88888703f2266f60588b5ac7ac0744740ce419c07b3c2fb464cd61fd330bc7289b8b722b655e642ebec456b3aa3b091759c5ad64a15c2f87203cea3688b
6
+ metadata.gz: 665b5a1dd6b59c9362db2c96d64c57f346d548617754bb9c47ead51adc0bba12db3c14fbf81c6d262fc7d1f772d1cd71af70e3d33fcf2673edfc5ab31815f7e2
7
+ data.tar.gz: c8244eafe0d02b15d0f89b362ac0a859f390a99f627c4fa777ce175b1e6fb7d20b9d0b20530b79ca2a05e4ffaf6bffbcd3ec1428cf208dd3eec3ee27f0b1ff12
@@ -0,0 +1,28 @@
1
+ on: [push, pull_request]
2
+ permissions:
3
+ contents: read
4
+
5
+ jobs:
6
+ test:
7
+ name: Ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}.gemfile
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ gemfile: [ 'rails_7_1' ]
12
+ ruby: [ '2.7', '3.2' ]
13
+ steps:
14
+ - name: Checkout source
15
+ uses: actions/checkout@v4
16
+ - name: Setup ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ bundler-cache: true # 'bundle install' and cache
21
+ env:
22
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
23
+ - name: Test
24
+ run: bundle exec rake test
25
+ env:
26
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
27
+
28
+
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  nonschema_migrations-*.gem
2
2
  coverage/
3
+ test/dummy_app/log/test.log
4
+ test/dummy_app/tmp/
3
5
 
6
+ .byebug_history
data/Appraisals CHANGED
@@ -1,32 +1,15 @@
1
-
2
- # appraise "rails-4-0" do
3
- # gem "rails", "4.0.10"
4
- # gem "minitest-rails", "~> 1.0"
5
- # end
6
- #
7
- # appraise "rails-4-1" do
8
- # gem "rails", "4.1.6"
9
- # gem "minitest"
10
- # end
11
- #
12
- # appraise "rails-4-2" do
13
- # gem "rails", "4.2.0"
14
- # gem "minitest"
15
- # end
16
- #
17
- # appraise "rails-5-0" do
18
- # gem "rails", "5.0.0"
19
- # gem "minitest"
20
- # end
21
-
22
- appraise "rails-5-1" do
23
- gem "rails", "5.1.5"
24
- end
25
-
26
1
  appraise "rails-5-2" do
27
- gem "rails", "5.2.0.rc1"
2
+ gem "rails", "5.2.0"
28
3
  end
29
4
 
30
5
  appraise "rails-6-0" do
31
6
  gem "rails", "6.0.0"
32
7
  end
8
+
9
+ appraise "rails-7-0" do
10
+ gem "rails", "7.0.8"
11
+ end
12
+
13
+ appraise "rails-7-1" do
14
+ gem "rails", "7.1"
15
+ end
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,11 @@
1
+ ### Tests
2
+
3
+ Some ways to invoke tests:
4
+ ```sh
5
+ bundle exec appraisal rails-7-1 bundle install
6
+ bundle exec appraisal rails-7-1 rake test
7
+ BACKTRACE=blegga bundle exec appraisal rails-7-0 rake test TEST=test/lib/nonschema_migrations/railties_test.rb
8
+ BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec rake test
9
+ BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec ruby test/lib/nonschema_migrations/railties_test.rb
10
+ BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec ruby test/lib/nonschema_migrations/railties_test.rb -n test_that_the_up_task_can_run
11
+ ```
data/Gemfile.lock CHANGED
@@ -1,33 +1,108 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonschema_migrations (6.0.alpha1)
5
- activerecord (= 7.0.0.alpha2)
4
+ nonschema_migrations (6.6)
5
+ rails (~> 7.1, >= 7.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (7.0.0.alpha2)
11
- activesupport (= 7.0.0.alpha2)
12
- activerecord (7.0.0.alpha2)
13
- activemodel (= 7.0.0.alpha2)
14
- activesupport (= 7.0.0.alpha2)
15
- activesupport (7.0.0.alpha2)
10
+ actioncable (7.1.2)
11
+ actionpack (= 7.1.2)
12
+ activesupport (= 7.1.2)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.2)
17
+ actionpack (= 7.1.2)
18
+ activejob (= 7.1.2)
19
+ activerecord (= 7.1.2)
20
+ activestorage (= 7.1.2)
21
+ activesupport (= 7.1.2)
22
+ mail (>= 2.7.1)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.1.2)
27
+ actionpack (= 7.1.2)
28
+ actionview (= 7.1.2)
29
+ activejob (= 7.1.2)
30
+ activesupport (= 7.1.2)
31
+ mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.2)
37
+ actionview (= 7.1.2)
38
+ activesupport (= 7.1.2)
39
+ nokogiri (>= 1.8.5)
40
+ racc
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
43
+ rack-test (>= 0.6.3)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.2)
47
+ actionpack (= 7.1.2)
48
+ activerecord (= 7.1.2)
49
+ activestorage (= 7.1.2)
50
+ activesupport (= 7.1.2)
51
+ globalid (>= 0.6.0)
52
+ nokogiri (>= 1.8.5)
53
+ actionview (7.1.2)
54
+ activesupport (= 7.1.2)
55
+ builder (~> 3.1)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.2)
60
+ activesupport (= 7.1.2)
61
+ globalid (>= 0.3.6)
62
+ activemodel (7.1.2)
63
+ activesupport (= 7.1.2)
64
+ activerecord (7.1.2)
65
+ activemodel (= 7.1.2)
66
+ activesupport (= 7.1.2)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.2)
69
+ actionpack (= 7.1.2)
70
+ activejob (= 7.1.2)
71
+ activerecord (= 7.1.2)
72
+ activesupport (= 7.1.2)
73
+ marcel (~> 1.0)
74
+ activesupport (7.1.2)
75
+ base64
76
+ bigdecimal
16
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
17
80
  i18n (>= 1.6, < 2)
18
81
  minitest (>= 5.1)
82
+ mutex_m
19
83
  tzinfo (~> 2.0)
20
- appraisal (2.4.1)
84
+ appraisal (2.5.0)
21
85
  bundler
22
86
  rake
23
87
  thor (>= 0.14.0)
88
+ base64 (0.2.0)
89
+ bigdecimal (3.1.5)
90
+ builder (3.2.4)
24
91
  coderay (1.1.3)
25
- concurrent-ruby (1.1.9)
26
- diff-lcs (1.4.4)
92
+ concurrent-ruby (1.2.2)
93
+ connection_pool (2.4.1)
94
+ crass (1.0.6)
95
+ date (3.3.4)
96
+ diff-lcs (1.5.0)
27
97
  docile (1.4.0)
28
- ffi (1.15.4)
29
- formatador (0.3.0)
30
- guard (2.18.0)
98
+ drb (2.2.0)
99
+ ruby2_keywords
100
+ erubi (1.12.0)
101
+ ffi (1.16.3)
102
+ formatador (1.1.0)
103
+ globalid (1.2.1)
104
+ activesupport (>= 6.1)
105
+ guard (2.18.1)
31
106
  formatador (>= 0.2.4)
32
107
  listen (>= 2.7, < 4.0)
33
108
  lumberjack (>= 1.0.12, < 2.0)
@@ -41,50 +116,131 @@ GEM
41
116
  guard (~> 2.1)
42
117
  guard-compat (~> 1.1)
43
118
  rspec (>= 2.99.0, < 4.0)
44
- i18n (1.8.11)
119
+ i18n (1.14.1)
45
120
  concurrent-ruby (~> 1.0)
46
- listen (3.7.0)
121
+ io-console (0.7.1)
122
+ irb (1.11.1)
123
+ rdoc
124
+ reline (>= 0.4.2)
125
+ listen (3.8.0)
47
126
  rb-fsevent (~> 0.10, >= 0.10.3)
48
127
  rb-inotify (~> 0.9, >= 0.9.10)
49
- lumberjack (1.2.8)
128
+ loofah (2.22.0)
129
+ crass (~> 1.0.2)
130
+ nokogiri (>= 1.12.0)
131
+ lumberjack (1.2.10)
132
+ mail (2.8.1)
133
+ mini_mime (>= 0.1.1)
134
+ net-imap
135
+ net-pop
136
+ net-smtp
137
+ marcel (1.0.2)
50
138
  method_source (1.0.0)
51
- minitest (5.14.4)
52
- minitest-rg (5.2.0)
139
+ mini_mime (1.1.5)
140
+ mini_portile2 (2.8.5)
141
+ minitest (5.20.0)
142
+ minitest-rg (5.3.0)
53
143
  minitest (~> 5.0)
144
+ mutex_m (0.2.0)
54
145
  nenv (0.3.0)
146
+ net-imap (0.4.9.1)
147
+ date
148
+ net-protocol
149
+ net-pop (0.1.2)
150
+ net-protocol
151
+ net-protocol (0.2.2)
152
+ timeout
153
+ net-smtp (0.4.0.1)
154
+ net-protocol
155
+ nio4r (2.7.0)
156
+ nokogiri (1.15.5)
157
+ mini_portile2 (~> 2.8.2)
158
+ racc (~> 1.4)
55
159
  notiffany (0.1.3)
56
160
  nenv (~> 0.1)
57
161
  shellany (~> 0.0)
58
- pry (0.14.1)
162
+ pry (0.14.2)
59
163
  coderay (~> 1.1)
60
164
  method_source (~> 1.0)
61
- rake (13.0.6)
62
- rb-fsevent (0.11.0)
165
+ psych (5.1.2)
166
+ stringio
167
+ racc (1.7.3)
168
+ rack (3.0.8)
169
+ rack-session (2.0.0)
170
+ rack (>= 3.0.0)
171
+ rack-test (2.1.0)
172
+ rack (>= 1.3)
173
+ rackup (2.1.0)
174
+ rack (>= 3)
175
+ webrick (~> 1.8)
176
+ rails (7.1.2)
177
+ actioncable (= 7.1.2)
178
+ actionmailbox (= 7.1.2)
179
+ actionmailer (= 7.1.2)
180
+ actionpack (= 7.1.2)
181
+ actiontext (= 7.1.2)
182
+ actionview (= 7.1.2)
183
+ activejob (= 7.1.2)
184
+ activemodel (= 7.1.2)
185
+ activerecord (= 7.1.2)
186
+ activestorage (= 7.1.2)
187
+ activesupport (= 7.1.2)
188
+ bundler (>= 1.15.0)
189
+ railties (= 7.1.2)
190
+ rails-dom-testing (2.2.0)
191
+ activesupport (>= 5.0.0)
192
+ minitest
193
+ nokogiri (>= 1.6)
194
+ rails-html-sanitizer (1.6.0)
195
+ loofah (~> 2.21)
196
+ nokogiri (~> 1.14)
197
+ railties (7.1.2)
198
+ actionpack (= 7.1.2)
199
+ activesupport (= 7.1.2)
200
+ irb
201
+ rackup (>= 1.0.0)
202
+ rake (>= 12.2)
203
+ thor (~> 1.0, >= 1.2.2)
204
+ zeitwerk (~> 2.6)
205
+ rake (13.1.0)
206
+ rb-fsevent (0.11.2)
63
207
  rb-inotify (0.10.1)
64
208
  ffi (~> 1.0)
65
- rspec (3.10.0)
66
- rspec-core (~> 3.10.0)
67
- rspec-expectations (~> 3.10.0)
68
- rspec-mocks (~> 3.10.0)
69
- rspec-core (3.10.1)
70
- rspec-support (~> 3.10.0)
71
- rspec-expectations (3.10.1)
209
+ rdoc (6.6.2)
210
+ psych (>= 4.0.0)
211
+ reline (0.4.2)
212
+ io-console (~> 0.5)
213
+ rspec (3.12.0)
214
+ rspec-core (~> 3.12.0)
215
+ rspec-expectations (~> 3.12.0)
216
+ rspec-mocks (~> 3.12.0)
217
+ rspec-core (3.12.2)
218
+ rspec-support (~> 3.12.0)
219
+ rspec-expectations (3.12.3)
72
220
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.10.0)
74
- rspec-mocks (3.10.2)
221
+ rspec-support (~> 3.12.0)
222
+ rspec-mocks (3.12.6)
75
223
  diff-lcs (>= 1.2.0, < 2.0)
76
- rspec-support (~> 3.10.0)
77
- rspec-support (3.10.3)
224
+ rspec-support (~> 3.12.0)
225
+ rspec-support (3.12.1)
226
+ ruby2_keywords (0.0.5)
78
227
  shellany (0.0.1)
79
- simplecov (0.21.2)
228
+ simplecov (0.22.0)
80
229
  docile (~> 1.1)
81
230
  simplecov-html (~> 0.11)
82
231
  simplecov_json_formatter (~> 0.1)
83
232
  simplecov-html (0.12.3)
84
- simplecov_json_formatter (0.1.3)
85
- thor (1.1.0)
86
- tzinfo (2.0.4)
233
+ simplecov_json_formatter (0.1.4)
234
+ stringio (3.1.0)
235
+ thor (1.3.0)
236
+ timeout (0.4.1)
237
+ tzinfo (2.0.6)
87
238
  concurrent-ruby (~> 1.0)
239
+ webrick (1.8.1)
240
+ websocket-driver (0.7.6)
241
+ websocket-extensions (>= 0.1.0)
242
+ websocket-extensions (0.1.5)
243
+ zeitwerk (2.6.12)
88
244
 
89
245
  PLATFORMS
90
246
  ruby
@@ -99,4 +255,4 @@ DEPENDENCIES
99
255
  simplecov
100
256
 
101
257
  BUNDLED WITH
102
- 1.17.2
258
+ 2.4.22
data/Procfile ADDED
@@ -0,0 +1,2 @@
1
+ web: bundle exec rails server -p $PORT
2
+ release: ./release-tasks.sh
data/README.md CHANGED
@@ -4,16 +4,17 @@
4
4
 
5
5
  _Please use the version number of this gem in lockstep with your Rails version._
6
6
 
7
- | Rails Version | | Use Version of This Gem | |
8
- |--------------|------------------|---------------------------------------------|-----|
9
- | Rails 4.x, 4.1.x, 4.2 | | v1.0.1 (Released Jun 1, 2019) | |
10
- | Rails 5.0 | | v2.0.1 (Released Jun 1, 2019) | |
11
- | Rails 5.1 | | v3.0.1 (Released Jun 1, 2019) | |
12
- | Rails 5.2 | | v4.0.2 (Released Jun 2, 2019) | |
13
- | Rails 6.0 | | v5.1.2.1 (Released Nov 17, 2021) | |
14
- | Rails 7.0.0.alpha2 | | v6.0.alpha2 (Released Nov 17, 2021) | |
15
- | Rails 7 | | v6.5 (Released Jan 11, 2022) | |
16
-
7
+ | Rails Version | | Use Version of This Gem | |
8
+ |-----------------------|------------------|----------------------------------|-----|
9
+ | Rails 4.x, 4.1.x, 4.2 | | v1.0.1 (Released Jun 1, 2019) | |
10
+ | Rails 5.0 | | v2.0.1 (Released Jun 1, 2019) | |
11
+ | Rails 5.1 | | v3.0.1 (Released Jun 1, 2019) | |
12
+ | Rails 5.2 | | v4.0.2 (Released Jun 2, 2019) | |
13
+ | Rails 6.0 | | v5.1.2.1 (Released Nov 17, 2021) | |
14
+ | Rails 7.0 | | v6.5.1 (Released Jan 4, 2024), ~v6.5.0 (Released Jan 11, 2022)~ | |
15
+ | Rails 7.1 | | not yet compatible | |
16
+
17
+ Note: yanked version 6.5 was not compatible with Rails 7.1. For Rails 7.0 please bump this gem to 6.5.1.
17
18
 
18
19
  ## Introduction
19
20
 
@@ -99,9 +100,6 @@ Migrate up the specified versions.
99
100
  ## rails data:rollback
100
101
  Rollback the last version. Generally data migrations don't have any "down" associated with them so use this only under extreme circumstances.
101
102
 
102
-
103
- #
104
-
105
103
  By default your data migration will run in a single transaction (just like a schema migration).
106
104
 
107
105
  To turn this off, add `disable_ddl_transaction!` to the top of your migration, like so:
@@ -138,29 +136,35 @@ advantage: your app is down only for schema migrations and you can let the data
138
136
  1. Deploy to heroku with preboot on
139
137
  2. Heroku switches the incoming requests to use the new app
140
138
  3. Run data migrations (while new app is up & running)
141
-
142
139
  advantage: your app is never down and you can run data migrations in the background
143
140
 
144
-
145
-
146
141
  ## Heroku Pipeline
147
-
148
-
149
- Release tasks should dbe **db:migrate**
150
- in `release-tasks.sh`
142
+ To use data migrations on the pipeline, the `release-tasks.sh` file should contain only the db:migrate
151
143
  ```
152
- bundle exec rails db:migrate
144
+ # Step to execute
145
+ bundle exec rails db:migrate
146
+ # check for a good exit
147
+ if [ 0 -ne 0 ]
148
+ then
149
+ puts '*** RELEASE COMMAND FAILED'
150
+ # something went wrong; convey that and exit
151
+ exit 1
152
+ fi
153
153
  ```
154
154
 
155
155
 
156
- The postdeply task shoul dbe **data:migrate**
156
+ The postdeply task should be **data:migrate**
157
157
  in `app.json`
158
158
  ```
159
159
  "scripts": {
160
160
  "postdeploy": "bundle exec rails data:migrate"
161
161
  }
162
162
  ```
163
- Using data migration is like seed data.
163
+ The above setup will run data migtrations only for REVIEW APPS.
164
+ You will still need to manually run the data migration for staging + production.
164
165
 
165
- However, the above setup will run only for REVIEW APPS. You will still need to manually run the data migration for staging + production.
166
+ If you want to use the data migrations for staging + production, remove the postdeploy script from `app.json` and change release-tasks.sh to :
167
+ ```
168
+ bundle exec rails db:migrate data:migrate
169
+ ```
166
170
 
data/Rakefile CHANGED
@@ -4,17 +4,19 @@ require "bundler/setup"
4
4
 
5
5
  require 'rake/testtask'
6
6
 
7
- # require "minitest"
8
- # require 'minist/autorun'
7
+ require 'byebug'
9
8
 
9
+ require "minitest/test_task"
10
10
 
11
- Rake::TestTask.new do |t|
11
+
12
+ Minitest::TestTask.create :test do |t|
12
13
  t.libs << 'test'
13
14
  t.libs << 'lib'
14
15
  t.libs << 'lib/generators'
15
16
  t.libs << 'lib/tasks'
16
17
  t.libs << 'lib/nonschema_migrations'
17
- t.pattern = 'test/**/*_test.rb'
18
+ t.test_globs = 'test/**/*_test.rb'
19
+ t.warning = false
18
20
  end
19
21
 
20
22
  desc "Run tests"
@@ -6,15 +6,16 @@ gem "appraisal"
6
6
  gem "guard"
7
7
  gem "guard-rspec"
8
8
  gem "rake"
9
- gem "byebug", platform: :mri_21
10
- gem "sqlite3"
11
- gem "mysql2"
12
- gem "mocha"
13
- gem "rails", "5.1.5"
14
9
  gem "minitest-rg"
10
+ gem "rails", "7.1"
11
+ gem "sqlite3"
12
+ gem "byebug"
13
+
15
14
 
16
15
  group :test do
17
16
  gem "simplecov", require: false
17
+ gem "mocha"
18
18
  end
19
19
 
20
20
  gemspec path: "../"
21
+