standalone_migrations 8.1.0 → 8.1.1
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 +15 -24
- data/Gemfile +10 -16
- data/README.markdown +48 -23
- data/Rakefile +6 -6
- data/VERSION +1 -1
- data/example/Gemfile +1 -1
- data/lib/standalone_migrations/configurator.rb +30 -1
- data/lib/standalone_migrations/tasks/connection.rake +4 -0
- data/spec/standalone_migrations_spec.rb +79 -7
- data/standalone_migrations.gemspec +10 -20
- metadata +8 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14d512977c6950048188c47d5eea093322255dc6dcca0cd0dd8639a9f88821df
|
|
4
|
+
data.tar.gz: e6317553e974ab4fdfc4411d19be999c7e5ba09887088a62df20518679361657
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30eba3ce1a3fa52d9b0e4021af516ef1596d7f2ea96dbfb2be99753d89c490a75f1980b35b161207ac2197f27fe8b265d4ee1c250b4b358d561b0f1810a60629
|
|
7
|
+
data.tar.gz: 65bdbc0a9cdd50094d16d17145f626eb28be8507b03dfbd6521e5d0e61124da3e90ac45846373953e3446d51d513510b23228134079a0a2608a50b045a705ff5
|
data/.github/workflows/CI.yml
CHANGED
|
@@ -9,44 +9,35 @@ on:
|
|
|
9
9
|
jobs:
|
|
10
10
|
build:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
|
+
continue-on-error: ${{ matrix.experimental || false }}
|
|
12
13
|
strategy:
|
|
13
14
|
fail-fast: false
|
|
14
15
|
matrix:
|
|
15
16
|
ruby:
|
|
16
|
-
- '2.7'
|
|
17
|
-
- '3.0'
|
|
18
|
-
- '3.1'
|
|
19
17
|
- '3.2'
|
|
18
|
+
- '3.3'
|
|
19
|
+
- '3.4'
|
|
20
20
|
activerecord:
|
|
21
|
-
- '6.0'
|
|
22
|
-
- '6.1'
|
|
23
|
-
- '7.0'
|
|
24
|
-
- '7.1'
|
|
25
21
|
- '7.2'
|
|
26
22
|
- '8.0'
|
|
23
|
+
- '8.1'
|
|
27
24
|
include:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- activerecord: '7.2'
|
|
34
|
-
ruby: '3.0'
|
|
35
|
-
- activerecord: '8.0'
|
|
36
|
-
ruby: '2.7'
|
|
37
|
-
- activerecord: '8.0'
|
|
38
|
-
ruby: '3.0'
|
|
39
|
-
- activerecord: '8.0'
|
|
40
|
-
ruby: '3.1'
|
|
25
|
+
# Ruby 4.0 is not yet officially supported by Rails; tracked here so
|
|
26
|
+
# breakage is visible, but not allowed to fail the build.
|
|
27
|
+
- ruby: '4.0'
|
|
28
|
+
activerecord: '8.1'
|
|
29
|
+
experimental: true
|
|
41
30
|
|
|
42
31
|
name: Ruby ${{ matrix.ruby }} / ActiveRecord ${{ matrix.activerecord }}
|
|
43
32
|
env:
|
|
44
|
-
|
|
33
|
+
AR: "~> ${{ matrix.activerecord }}"
|
|
34
|
+
# jeweler is release-only tooling; keep it and its 2018-era dependency
|
|
35
|
+
# tree out of the install. Note this skips installation, not resolution.
|
|
36
|
+
BUNDLE_WITHOUT: release
|
|
45
37
|
steps:
|
|
46
|
-
- uses: actions/checkout@
|
|
38
|
+
- uses: actions/checkout@v5
|
|
47
39
|
- uses: ruby/setup-ruby@v1
|
|
48
40
|
with:
|
|
49
41
|
ruby-version: ${{ matrix.ruby }}
|
|
50
42
|
bundler-cache: true
|
|
51
|
-
- run:
|
|
52
|
-
bundle exec rake
|
|
43
|
+
- run: bundle exec rake
|
data/Gemfile
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
gem 'rake', '>= 10.0'
|
|
4
|
-
gem 'activerecord', ENV['AR'] ? ENV['AR'].split(",") : [">=
|
|
5
|
-
gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">=
|
|
6
|
-
gem 'nokogiri', "~> 1.14"
|
|
4
|
+
gem 'activerecord', ENV['AR'] ? ENV['AR'].split(",") : [">= 7.2.0", "< 8.2"]
|
|
5
|
+
gem 'railties', ENV['AR'] ? ENV['AR'].split(",") : [">= 7.2.0", "< 8.2"]
|
|
7
6
|
gem 'logger'
|
|
8
7
|
|
|
9
|
-
def sqlite3_version
|
|
10
|
-
return "< 1.7" unless ENV["AR"]
|
|
11
|
-
|
|
12
|
-
ar_version = ENV['AR'].split(",").last.match(/\d+\.\d+/)[0]
|
|
13
|
-
|
|
14
|
-
case Gem::Version.new(ar_version)
|
|
15
|
-
# Active Record 8.x requires sqlite3 >= 2.1
|
|
16
|
-
when Gem::Version.new("8.0").. then ">= 2.1"
|
|
17
|
-
else "< 1.7"
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
8
|
group :dev do
|
|
22
|
-
|
|
9
|
+
# Active Record 8.x requires sqlite3 >= 2.1, and the 7.2 adapter declares
|
|
10
|
+
# `gem "sqlite3", ">= 1.4"`, so 2.x covers every supported Rails series.
|
|
11
|
+
gem 'sqlite3', '>= 2.1'
|
|
23
12
|
gem 'rspec', '>= 2.99.0'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Only needed to cut a release. Excluded in CI via
|
|
16
|
+
# `bundle config set --local without release`.
|
|
17
|
+
group :release do
|
|
24
18
|
gem 'jeweler'
|
|
25
19
|
end
|
data/README.markdown
CHANGED
|
@@ -2,13 +2,26 @@ Rails migrations in non-Rails (and non Ruby) projects.
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/thuss/standalone-migrations/actions)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
COMPATIBILITY
|
|
6
|
+
=============
|
|
7
|
+
|
|
8
|
+
The gem version tracks the newest Rails version it supports.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
| standalone_migrations | Rails | Ruby |
|
|
11
|
+
| --------------------- | ----------- | ------ |
|
|
12
|
+
| 8.1.1 | 7.2 - 8.1 | 3.2+ |
|
|
13
|
+
| 8.1.0 | 6.0 - 8.1 | 2.7+ |
|
|
14
|
+
| 8.0.0 | 6.0 - 8.0 | 2.7+ |
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
8.1.1 drops Rails 6.0, 6.1, 7.0 and 7.1, all of which are past their end-of-life.
|
|
17
|
+
If your Gemfile pins a Rails version, Bundler resolves you to 8.1.0 automatically and
|
|
18
|
+
nothing changes. If it does not pin one — or you install with `gem install` — you will
|
|
19
|
+
get 8.1.1 and Rails 8.1 alongside it, so pin `gem 'standalone_migrations', '8.1.0'`
|
|
20
|
+
to stay where you are.
|
|
21
|
+
|
|
22
|
+
Dropping those Rails versions does *not* affect your existing migration files. Rails 8.1
|
|
23
|
+
still ships `ActiveRecord::Migration` compatibility shims all the way back to `[4.2]`, so
|
|
24
|
+
migrations written years ago continue to run unchanged.
|
|
12
25
|
|
|
13
26
|
CONTRIBUTE
|
|
14
27
|
==========
|
|
@@ -16,7 +29,7 @@ CONTRIBUTE
|
|
|
16
29
|
|
|
17
30
|
USAGE
|
|
18
31
|
=====
|
|
19
|
-
Install Ruby, RubyGems and a ruby-database driver (e.g. `gem install
|
|
32
|
+
Install Ruby (3.2 or newer), RubyGems and a ruby-database driver (e.g. `gem install pg` or `gem install mysql2`) then:
|
|
20
33
|
|
|
21
34
|
$ gem install standalone_migrations
|
|
22
35
|
|
|
@@ -45,7 +58,7 @@ Add database configuration to `db/config.yml` in your projects base directory e.
|
|
|
45
58
|
timeout: 5000
|
|
46
59
|
|
|
47
60
|
production:
|
|
48
|
-
adapter:
|
|
61
|
+
adapter: mysql2
|
|
49
62
|
encoding: utf8
|
|
50
63
|
reconnect: false
|
|
51
64
|
database: somedatabase_dev
|
|
@@ -191,31 +204,41 @@ you can use the `StandaloneMigrations::Configurator.environments_config`
|
|
|
191
204
|
method. Check the usage example:
|
|
192
205
|
|
|
193
206
|
```ruby
|
|
194
|
-
require '
|
|
207
|
+
require 'standalone_migrations'
|
|
208
|
+
StandaloneMigrations::Tasks.load_tasks
|
|
195
209
|
|
|
196
210
|
StandaloneMigrations::Configurator.environments_config do |env|
|
|
197
211
|
|
|
198
212
|
env.on "production" do
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
:
|
|
204
|
-
:
|
|
205
|
-
:
|
|
206
|
-
:password => db.password,
|
|
207
|
-
:database => db.path[1..-1],
|
|
213
|
+
if ENV['DB_HOST']
|
|
214
|
+
{
|
|
215
|
+
:adapter => 'postgresql',
|
|
216
|
+
:host => ENV['DB_HOST'],
|
|
217
|
+
:username => ENV['DB_USER'],
|
|
218
|
+
:password => ENV['DB_PASSWORD'],
|
|
219
|
+
:database => ENV['DB_NAME'],
|
|
208
220
|
:encoding => 'utf8'
|
|
209
221
|
}
|
|
210
222
|
end
|
|
211
|
-
|
|
212
|
-
nil
|
|
213
223
|
end
|
|
214
224
|
|
|
215
225
|
end
|
|
216
226
|
```
|
|
217
227
|
|
|
218
|
-
|
|
228
|
+
The block's *value* is what gets used, so do not use `return` here — a `return` inside
|
|
229
|
+
the block aborts the rest of your `Rakefile` instead of handing the hash back. Let the
|
|
230
|
+
`if` be the last expression: it evaluates to your new config hash when the branch is
|
|
231
|
+
taken, and to `nil` otherwise, which leaves the environment unchanged.
|
|
232
|
+
|
|
233
|
+
**On Heroku you do not need this at all.** Rails reads `DATABASE_URL` itself and merges
|
|
234
|
+
it into the current environment's configuration *after* this block runs, so a hash
|
|
235
|
+
returned here is discarded whenever `DATABASE_URL` is set. Just set `DATABASE_URL` and
|
|
236
|
+
let Rails handle it; use `environments_config` for settings Rails' URL handling does not
|
|
237
|
+
already cover.
|
|
238
|
+
|
|
239
|
+
Put this in your `Rakefile` *below* the `StandaloneMigrations::Tasks.load_tasks`
|
|
240
|
+
call, as in the example above -- that call is what locates your `db/config.yml`,
|
|
241
|
+
so a block placed above it is ignored. If you want to
|
|
219
242
|
change some configuration, call the #on method on the object
|
|
220
243
|
received as argument in your block passed to ::environments_config
|
|
221
244
|
method call. The #on method receives the key to the configuration
|
|
@@ -228,7 +251,8 @@ in your current configuration? Then you should receive the configuration
|
|
|
228
251
|
in your block, like this:
|
|
229
252
|
|
|
230
253
|
```ruby
|
|
231
|
-
require '
|
|
254
|
+
require 'standalone_migrations'
|
|
255
|
+
StandaloneMigrations::Tasks.load_tasks
|
|
232
256
|
|
|
233
257
|
StandaloneMigrations::Configurator.environments_config do |env|
|
|
234
258
|
|
|
@@ -248,8 +272,9 @@ save the database-specific SQL generated by the migrations, simply
|
|
|
248
272
|
add this to your `Rakefile`.
|
|
249
273
|
|
|
250
274
|
```ruby
|
|
251
|
-
require '
|
|
252
|
-
|
|
275
|
+
require 'standalone_migrations'
|
|
276
|
+
StandaloneMigrations::Tasks.load_tasks
|
|
277
|
+
ActiveRecord.schema_format = :sql
|
|
253
278
|
```
|
|
254
279
|
|
|
255
280
|
You should see a `db/structure.sql` file the next time you run a
|
data/Rakefile
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
|
3
3
|
|
|
4
|
-
task :all do
|
|
5
|
-
sh "AR='~>3.0.0' bundle update activerecord && bundle exec rake"
|
|
6
|
-
sh "AR='~>3.1.0.rc4' bundle update activerecord && bundle exec rake"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
4
|
begin
|
|
10
5
|
require 'rspec/core/rake_task'
|
|
11
6
|
RSpec::Core::RakeTask.new(:spec)
|
|
@@ -16,12 +11,16 @@ end
|
|
|
16
11
|
# rake install -> install gem locally (for tests)
|
|
17
12
|
# rake release -> push to github and release to gemcutter
|
|
18
13
|
# rake version:bump:patch -> increase version and add a git-tag
|
|
14
|
+
#
|
|
15
|
+
# Jeweler lives in the :release bundler group so that CI (and anyone just
|
|
16
|
+
# running the specs) does not have to install it. `bundle config set --local
|
|
17
|
+
# without release` keeps it out of the bundle; the rescue below handles that.
|
|
19
18
|
begin
|
|
20
19
|
require 'jeweler'
|
|
21
20
|
rescue LoadError => e
|
|
22
21
|
$stderr.puts "Jeweler, or one of its dependencies, is not available:"
|
|
23
22
|
$stderr.puts "#{e.class}: #{e.message}"
|
|
24
|
-
$stderr.puts "
|
|
23
|
+
$stderr.puts "It lives in the :release group; install it with: BUNDLE_WITHOUT= bundle install"
|
|
25
24
|
else
|
|
26
25
|
Jeweler::Tasks.new do |gem|
|
|
27
26
|
gem.name = 'standalone_migrations'
|
|
@@ -30,6 +29,7 @@ else
|
|
|
30
29
|
gem.homepage = "http://github.com/thuss/standalone-migrations"
|
|
31
30
|
gem.authors = ["Todd Huss", "Michael Grosser"]
|
|
32
31
|
gem.license = "MIT"
|
|
32
|
+
gem.required_ruby_version = '>= 3.2.0'
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
8.1.
|
|
1
|
+
8.1.1
|
data/example/Gemfile
CHANGED
|
@@ -25,8 +25,28 @@ module StandaloneMigrations
|
|
|
25
25
|
@env_config
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def self.database_config_present?
|
|
29
|
+
!@env_config.nil? ||
|
|
30
|
+
Rails.application.config.paths["config/database"].existent.any?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.configured!
|
|
34
|
+
@configured = true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.configured?
|
|
38
|
+
!!@configured
|
|
39
|
+
end
|
|
40
|
+
|
|
28
41
|
def self.environments_config
|
|
29
|
-
|
|
42
|
+
config =
|
|
43
|
+
if database_config_present?
|
|
44
|
+
load_configurations
|
|
45
|
+
else
|
|
46
|
+
warn_called_too_early unless configured?
|
|
47
|
+
{}
|
|
48
|
+
end
|
|
49
|
+
proxy = InternalConfigurationsProxy.new(config)
|
|
30
50
|
yield(proxy) if block_given?
|
|
31
51
|
end
|
|
32
52
|
|
|
@@ -46,6 +66,8 @@ module StandaloneMigrations
|
|
|
46
66
|
c_os['paths'].each do |path, value|
|
|
47
67
|
rac.paths[path] = value
|
|
48
68
|
end
|
|
69
|
+
|
|
70
|
+
Configurator.configured!
|
|
49
71
|
end
|
|
50
72
|
|
|
51
73
|
def config_for_all
|
|
@@ -100,6 +122,13 @@ module StandaloneMigrations
|
|
|
100
122
|
@schema
|
|
101
123
|
end
|
|
102
124
|
|
|
125
|
+
def self.warn_called_too_early
|
|
126
|
+
warn "StandaloneMigrations::Configurator.environments_config was called " \
|
|
127
|
+
"before StandaloneMigrations::Tasks.load_tasks, so the database " \
|
|
128
|
+
"config had not been located yet and the block was ignored. Move it " \
|
|
129
|
+
"below your StandaloneMigrations::Tasks.load_tasks call."
|
|
130
|
+
end
|
|
131
|
+
|
|
103
132
|
private
|
|
104
133
|
|
|
105
134
|
def configuration_file
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
require File.expand_path("../../../standalone_migrations", __FILE__)
|
|
2
2
|
namespace :standalone do
|
|
3
3
|
task :connection do
|
|
4
|
+
StandaloneMigrations::Configurator.environments_config do |proxy|
|
|
5
|
+
ActiveRecord::Tasks::DatabaseTasks.database_configuration = proxy.configurations
|
|
6
|
+
end
|
|
7
|
+
# Raises when the config is still missing; keep.
|
|
4
8
|
StandaloneMigrations::Configurator.load_configurations
|
|
5
9
|
ActiveRecord::Base.establish_connection
|
|
6
10
|
StandaloneMigrations.run_on_load_callbacks
|
|
@@ -50,11 +50,7 @@ end
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def write_multiple_migrations
|
|
53
|
-
migration_superclass =
|
|
54
|
-
"ActiveRecord::Migration[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
|
55
|
-
else
|
|
56
|
-
"ActiveRecord::Migration"
|
|
57
|
-
end
|
|
53
|
+
migration_superclass = "ActiveRecord::Migration[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
|
58
54
|
|
|
59
55
|
write_rakefile %{t.migrations = "db/migrations", "db/migrations2"}
|
|
60
56
|
write "db/migrate/20100509095815_create_tests.rb", <<-TXT
|
|
@@ -114,6 +110,82 @@ production:
|
|
|
114
110
|
expect(run("rake db:create --trace")).to match(warning)
|
|
115
111
|
end
|
|
116
112
|
|
|
113
|
+
it "leaves the config loaded for tasks that connect themselves" do
|
|
114
|
+
File.open('Rakefile', 'a') do |f|
|
|
115
|
+
f.puts "task(:selfconnect) { ActiveRecord::Base.establish_connection; puts %{SELFCONNECT-OK} }"
|
|
116
|
+
end
|
|
117
|
+
expect(run("rake selfconnect")).to match(/SELFCONNECT-OK/)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
describe 'environments_config' do
|
|
121
|
+
it "applies an override to the config the tasks use" do
|
|
122
|
+
File.open('Rakefile', 'a') do |f|
|
|
123
|
+
f.puts "StandaloneMigrations::Configurator.environments_config do |env|"
|
|
124
|
+
f.puts " env.on(%{development}) { {%{adapter} => %{sqlite3}, %{database} => %{db/OVERRIDDEN.sql}} }"
|
|
125
|
+
f.puts "end"
|
|
126
|
+
end
|
|
127
|
+
run "rake db:create"
|
|
128
|
+
expect(File.exist?('db/OVERRIDDEN.sql')).to be true
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it "warns when it is called before load_tasks instead of ignoring the block" do
|
|
132
|
+
write 'Rakefile', <<-TXT
|
|
133
|
+
$LOAD_PATH.unshift '#{File.expand_path('../../lib')}'
|
|
134
|
+
require "standalone_migrations"
|
|
135
|
+
StandaloneMigrations::Configurator.environments_config { |env| env.on("development") { nil } }
|
|
136
|
+
StandaloneMigrations::Tasks.load_tasks
|
|
137
|
+
TXT
|
|
138
|
+
expect(run("rake --tasks")).to match(/called before/)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
describe 'with DATABASE_URL and no db/config.yml' do
|
|
143
|
+
before { FileUtils.rm('db/config.yml') }
|
|
144
|
+
|
|
145
|
+
it "uses the URL instead of demanding a config file" do
|
|
146
|
+
expect(run("DATABASE_URL=sqlite3:db/from_url.sql rake db:version")).to match(/Current version: 0/)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
describe 'without db/config.yml' do
|
|
151
|
+
before { FileUtils.rm('db/config.yml') }
|
|
152
|
+
|
|
153
|
+
it "still lists the tasks" do
|
|
154
|
+
expect(run("rake --tasks")).to match(/db:migrate/)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it "runs an unrelated task, which may be the one that writes the config" do
|
|
158
|
+
File.open('Rakefile', 'a') { |f| f.puts "task(:unrelated) { puts %{RAN-UNRELATED} }" }
|
|
159
|
+
expect(run("rake unrelated")).to match(/RAN-UNRELATED/)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "still fails helpfully for a task that needs the config" do
|
|
163
|
+
expect { run("rake db:migrate") }.to raise_error(/Could not load database configuration/)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it "runs when the Rakefile configures environments at load time" do
|
|
167
|
+
File.open('Rakefile', 'a') do |f|
|
|
168
|
+
f.puts "StandaloneMigrations::Configurator.environments_config { |env| env.on(%{production}) { nil } }"
|
|
169
|
+
f.puts "task(:unrelated) { puts %{RAN-UNRELATED} }"
|
|
170
|
+
end
|
|
171
|
+
output = run("rake unrelated")
|
|
172
|
+
expect(output).to match(/RAN-UNRELATED/)
|
|
173
|
+
expect(output).not_to match(/called before/)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
it "picks up the config once another task writes it" do
|
|
177
|
+
write 'db/config.yml.example', <<-TXT
|
|
178
|
+
development:
|
|
179
|
+
adapter: sqlite3
|
|
180
|
+
database: db/development.sql
|
|
181
|
+
TXT
|
|
182
|
+
File.open('Rakefile', 'a') do |f|
|
|
183
|
+
f.puts "task(:write_config) { require %{fileutils}; FileUtils.cp(%{db/config.yml.example}, %{db/config.yml}) }"
|
|
184
|
+
end
|
|
185
|
+
expect(run("rake write_config db:version")).to match(/Current version: 0/)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
117
189
|
describe 'db:create and drop' do
|
|
118
190
|
it "should create the database and drop the database that was created" do
|
|
119
191
|
run "rake db:create"
|
|
@@ -351,14 +423,14 @@ production:
|
|
|
351
423
|
end
|
|
352
424
|
|
|
353
425
|
describe 'db:migrate when environment is specified' do
|
|
354
|
-
it "runs when using the DB environment variable"
|
|
426
|
+
it "runs when using the DB environment variable" do
|
|
355
427
|
make_migration('yyy')
|
|
356
428
|
run('rake db:migrate RAILS_ENV=test')
|
|
357
429
|
expect(run('rake db:version RAILS_ENV=test')).not_to match(/version: 0/)
|
|
358
430
|
expect(run('rake db:version')).to match(/version: 0/)
|
|
359
431
|
end
|
|
360
432
|
|
|
361
|
-
it "should error on an invalid database"
|
|
433
|
+
it "should error on an invalid database" do
|
|
362
434
|
expect { run("rake db:create RAILS_ENV=nonexistent") }.to raise_error(/rake aborted/)
|
|
363
435
|
end
|
|
364
436
|
end
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: standalone_migrations 8.1.
|
|
5
|
+
# stub: standalone_migrations 8.1.1 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "standalone_migrations".freeze
|
|
9
|
-
s.version = "8.1.
|
|
9
|
+
s.version = "8.1.1".freeze
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
|
13
13
|
s.authors = ["Todd Huss".freeze, "Michael Grosser".freeze]
|
|
14
|
-
s.date = "
|
|
14
|
+
s.date = "1980-01-02"
|
|
15
15
|
s.email = "thuss@gabrito.com".freeze
|
|
16
16
|
s.extra_rdoc_files = [
|
|
17
17
|
"LICENSE",
|
|
@@ -57,25 +57,15 @@ Gem::Specification.new do |s|
|
|
|
57
57
|
]
|
|
58
58
|
s.homepage = "http://github.com/thuss/standalone-migrations".freeze
|
|
59
59
|
s.licenses = ["MIT".freeze]
|
|
60
|
-
s.
|
|
60
|
+
s.required_ruby_version = Gem::Requirement.new(">= 3.2.0".freeze)
|
|
61
|
+
s.rubygems_version = "3.6.9".freeze
|
|
61
62
|
s.summary = "A thin wrapper to use Rails Migrations in non Rails projects".freeze
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
s.specification_version = 4
|
|
65
|
-
end
|
|
64
|
+
s.specification_version = 4
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
s.add_runtime_dependency(%q<nokogiri>.freeze, ["~> 1.14"])
|
|
72
|
-
s.add_runtime_dependency(%q<logger>.freeze, [">= 0"])
|
|
73
|
-
else
|
|
74
|
-
s.add_dependency(%q<rake>.freeze, [">= 10.0"])
|
|
75
|
-
s.add_dependency(%q<activerecord>.freeze, [">= 6.0.0", "< 8.2"])
|
|
76
|
-
s.add_dependency(%q<railties>.freeze, [">= 6.0.0", "< 8.2"])
|
|
77
|
-
s.add_dependency(%q<nokogiri>.freeze, ["~> 1.14"])
|
|
78
|
-
s.add_dependency(%q<logger>.freeze, [">= 0"])
|
|
79
|
-
end
|
|
66
|
+
s.add_runtime_dependency(%q<rake>.freeze, [">= 10.0".freeze])
|
|
67
|
+
s.add_runtime_dependency(%q<activerecord>.freeze, [">= 7.2.0".freeze, "< 8.2".freeze])
|
|
68
|
+
s.add_runtime_dependency(%q<railties>.freeze, [">= 7.2.0".freeze, "< 8.2".freeze])
|
|
69
|
+
s.add_runtime_dependency(%q<logger>.freeze, [">= 0".freeze])
|
|
80
70
|
end
|
|
81
71
|
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standalone_migrations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Todd Huss
|
|
8
8
|
- Michael Grosser
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rake
|
|
@@ -31,7 +30,7 @@ dependencies:
|
|
|
31
30
|
requirements:
|
|
32
31
|
- - ">="
|
|
33
32
|
- !ruby/object:Gem::Version
|
|
34
|
-
version:
|
|
33
|
+
version: 7.2.0
|
|
35
34
|
- - "<"
|
|
36
35
|
- !ruby/object:Gem::Version
|
|
37
36
|
version: '8.2'
|
|
@@ -41,7 +40,7 @@ dependencies:
|
|
|
41
40
|
requirements:
|
|
42
41
|
- - ">="
|
|
43
42
|
- !ruby/object:Gem::Version
|
|
44
|
-
version:
|
|
43
|
+
version: 7.2.0
|
|
45
44
|
- - "<"
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
46
|
version: '8.2'
|
|
@@ -51,7 +50,7 @@ dependencies:
|
|
|
51
50
|
requirements:
|
|
52
51
|
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
53
|
+
version: 7.2.0
|
|
55
54
|
- - "<"
|
|
56
55
|
- !ruby/object:Gem::Version
|
|
57
56
|
version: '8.2'
|
|
@@ -61,24 +60,10 @@ dependencies:
|
|
|
61
60
|
requirements:
|
|
62
61
|
- - ">="
|
|
63
62
|
- !ruby/object:Gem::Version
|
|
64
|
-
version:
|
|
63
|
+
version: 7.2.0
|
|
65
64
|
- - "<"
|
|
66
65
|
- !ruby/object:Gem::Version
|
|
67
66
|
version: '8.2'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: nokogiri
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '1.14'
|
|
75
|
-
type: :runtime
|
|
76
|
-
prerelease: false
|
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '1.14'
|
|
82
67
|
- !ruby/object:Gem::Dependency
|
|
83
68
|
name: logger
|
|
84
69
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -93,7 +78,6 @@ dependencies:
|
|
|
93
78
|
- - ">="
|
|
94
79
|
- !ruby/object:Gem::Version
|
|
95
80
|
version: '0'
|
|
96
|
-
description:
|
|
97
81
|
email: thuss@gabrito.com
|
|
98
82
|
executables: []
|
|
99
83
|
extensions: []
|
|
@@ -141,7 +125,6 @@ homepage: http://github.com/thuss/standalone-migrations
|
|
|
141
125
|
licenses:
|
|
142
126
|
- MIT
|
|
143
127
|
metadata: {}
|
|
144
|
-
post_install_message:
|
|
145
128
|
rdoc_options: []
|
|
146
129
|
require_paths:
|
|
147
130
|
- lib
|
|
@@ -149,15 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
149
132
|
requirements:
|
|
150
133
|
- - ">="
|
|
151
134
|
- !ruby/object:Gem::Version
|
|
152
|
-
version:
|
|
135
|
+
version: 3.2.0
|
|
153
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
137
|
requirements:
|
|
155
138
|
- - ">="
|
|
156
139
|
- !ruby/object:Gem::Version
|
|
157
140
|
version: '0'
|
|
158
141
|
requirements: []
|
|
159
|
-
rubygems_version: 3.
|
|
160
|
-
signing_key:
|
|
142
|
+
rubygems_version: 3.6.9
|
|
161
143
|
specification_version: 4
|
|
162
144
|
summary: A thin wrapper to use Rails Migrations in non Rails projects
|
|
163
145
|
test_files: []
|