actual_db_schema 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +6 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +5 -1
- data/README.md +21 -1
- data/gemfiles/rails.edge.gemfile +15 -0
- data/lib/actual_db_schema/commands/base.rb +13 -4
- data/lib/actual_db_schema/commands/list.rb +10 -1
- data/lib/actual_db_schema/version.rb +1 -1
- data/lib/actual_db_schema.rb +7 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bae784cf88c546a852fea372e8bcbf1356008bc36c9e63c6ff0e18fb1c06bd6
|
4
|
+
data.tar.gz: 0fc13227fd92ecb46f7d10f16d900477115a2ca960c701a2080d19690f1631d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 226db7dc680bb706a73048c1fec3e52685a1e36ac5d5e2cef82511080234e1cc6b789cb5266ea101669462205823ec565da9b059cc7d4b0752fc4f600f0cfbe2
|
7
|
+
data.tar.gz: 47c936d8bb2cddf627dbb04ab8d3993e71a960363d4472c9ef9fa4b2102b89789fea7257333b6b91e38ffe1a288c52b5e72ef619377c97276684a0f46dd04ee1
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
actual_db_schema (0.7.
|
4
|
+
actual_db_schema (0.7.4)
|
5
5
|
activerecord (>= 6.0.0)
|
6
6
|
activesupport (>= 6.0.0)
|
7
7
|
csv
|
@@ -133,6 +133,8 @@ GEM
|
|
133
133
|
net-smtp (0.4.0)
|
134
134
|
net-protocol
|
135
135
|
nio4r (2.5.9)
|
136
|
+
nokogiri (1.15.4-arm64-darwin)
|
137
|
+
racc (~> 1.4)
|
136
138
|
nokogiri (1.15.4-x86_64-darwin)
|
137
139
|
racc (~> 1.4)
|
138
140
|
nokogiri (1.15.4-x86_64-linux)
|
@@ -204,6 +206,7 @@ GEM
|
|
204
206
|
parser (>= 3.2.1.0)
|
205
207
|
ruby-progressbar (1.13.0)
|
206
208
|
ruby2_keywords (0.0.5)
|
209
|
+
sqlite3 (1.6.8-arm64-darwin)
|
207
210
|
sqlite3 (1.6.8-x86_64-darwin)
|
208
211
|
sqlite3 (1.6.8-x86_64-linux)
|
209
212
|
stringio (3.0.8)
|
@@ -219,6 +222,7 @@ GEM
|
|
219
222
|
zeitwerk (2.6.12)
|
220
223
|
|
221
224
|
PLATFORMS
|
225
|
+
arm64-darwin-23
|
222
226
|
x86_64-darwin-20
|
223
227
|
x86_64-darwin-22
|
224
228
|
x86_64-linux
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ If you cannot commit changes to the repo or Gemfile, consider the local Gemfile
|
|
52
52
|
|
53
53
|
## Usage
|
54
54
|
|
55
|
-
Just run `rails db:migrate` inside the current branch.
|
55
|
+
Just run `rails db:migrate` inside the current branch. It will roll back all phantom migrations for all configured databases in your `database.yml.`
|
56
56
|
|
57
57
|
> [!WARNING]
|
58
58
|
> This solution implies that all migrations are reversible. The irreversible migrations should be solved manually. At the moment, the gem ignores them. You will see warnings in the terminal for each irreversible migrations.
|
@@ -75,6 +75,26 @@ To release a new version do the following in the order:
|
|
75
75
|
- make the commit and push;
|
76
76
|
- run `bundle exec rake release`. This will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
77
77
|
|
78
|
+
### Running Tests with Specific Rails Versions
|
79
|
+
|
80
|
+
The following versions can be specifically tested using Appraisal
|
81
|
+
- 6.0
|
82
|
+
- 6.1
|
83
|
+
- 7.0
|
84
|
+
- 7.1
|
85
|
+
- edge
|
86
|
+
|
87
|
+
To run tests with a specific version of Rails using Appraisal:
|
88
|
+
- Run all tests with Rails 6.0:
|
89
|
+
```sh
|
90
|
+
bundle exec appraisal rails.6.0 rake test
|
91
|
+
- Run tests for a specific file:
|
92
|
+
```sh
|
93
|
+
bundle exec appraisal rails.6.0 rake test TEST=test/rake_task_test.rb
|
94
|
+
- Run a specific test:
|
95
|
+
```sh
|
96
|
+
bundle exec appraisal rails.6.0 rake test TEST=test/rake_task_test.rb TESTOPTS="--name=/db::db:rollback_branches#test_0003_keeps/"
|
97
|
+
|
78
98
|
## Contributing
|
79
99
|
|
80
100
|
Bug reports and pull requests are welcome on GitHub at https://github.com/widefix/actual_db_schema. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/widefix/actual_db_schema/blob/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by Appraisal
|
4
|
+
|
5
|
+
source "https://rubygems.org"
|
6
|
+
|
7
|
+
gem "activerecord", ">= 7.2.0.beta"
|
8
|
+
gem "activesupport", ">= 7.2.0.beta"
|
9
|
+
gem "minitest", "~> 5.0"
|
10
|
+
gem "rake"
|
11
|
+
gem "rubocop", "~> 1.21"
|
12
|
+
gem "rails", ">= 7.2.0.beta"
|
13
|
+
gem "sqlite3"
|
14
|
+
|
15
|
+
gemspec path: "../"
|
@@ -19,10 +19,19 @@ module ActualDbSchema
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def context
|
22
|
-
@context ||=
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
@context ||= fetch_migration_context.tap do |c|
|
23
|
+
c.extend(ActualDbSchema::Patches::MigrationContext)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def fetch_migration_context
|
28
|
+
ar_version = Gem::Version.new(ActiveRecord::VERSION::STRING)
|
29
|
+
if ar_version >= Gem::Version.new("7.2.0") ||
|
30
|
+
(ar_version >= Gem::Version.new("7.1.0") && ar_version.prerelease?)
|
31
|
+
ActiveRecord::Base.connection_pool.migration_context
|
32
|
+
else
|
33
|
+
ActiveRecord::Base.connection.migration_context
|
34
|
+
end
|
26
35
|
end
|
27
36
|
end
|
28
37
|
end
|
@@ -19,11 +19,20 @@ module ActualDbSchema
|
|
19
19
|
puts "\nPhantom migrations\n\n"
|
20
20
|
puts "Below is a list of irrelevant migrations executed in unmerged branches."
|
21
21
|
puts "To bring your database schema up to date, the migrations marked as \"up\" should be rolled back."
|
22
|
-
|
22
|
+
database_path = db_config[:database]
|
23
|
+
puts "\ndatabase: #{database_path}\n\n"
|
23
24
|
puts header.join(" ")
|
24
25
|
puts "-" * separator_width
|
25
26
|
end
|
26
27
|
|
28
|
+
def db_config
|
29
|
+
if ActiveRecord::Base.respond_to?(:connection_db_config)
|
30
|
+
ActiveRecord::Base.connection_db_config.configuration_hash
|
31
|
+
else
|
32
|
+
ActiveRecord::Base.connection_config
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
27
36
|
def separator_width
|
28
37
|
header.map(&:length).sum + (header.size - 1) * 2
|
29
38
|
end
|
data/lib/actual_db_schema.rb
CHANGED
@@ -50,7 +50,11 @@ module ActualDbSchema
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def self.migrations_paths
|
53
|
-
ActiveRecord::Base.connection_db_config
|
53
|
+
if ActiveRecord::Base.respond_to?(:connection_db_config)
|
54
|
+
ActiveRecord::Base.connection_db_config.migrations_paths
|
55
|
+
else
|
56
|
+
ActiveRecord::Base.connection_config[:migrations_paths]
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
def self.migration_filename(fullpath)
|
@@ -60,7 +64,8 @@ module ActualDbSchema
|
|
60
64
|
def self.for_each_db_connection
|
61
65
|
configs = ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env)
|
62
66
|
configs.each do |db_config|
|
63
|
-
|
67
|
+
config = db_config.respond_to?(:config) ? db_config.config : db_config
|
68
|
+
ActiveRecord::Base.establish_connection(config)
|
64
69
|
yield
|
65
70
|
end
|
66
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actual_db_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Kaleshka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- gemfiles/rails.6.1.gemfile
|
132
132
|
- gemfiles/rails.7.0.gemfile
|
133
133
|
- gemfiles/rails.7.1.gemfile
|
134
|
+
- gemfiles/rails.edge.gemfile
|
134
135
|
- lib/actual_db_schema.rb
|
135
136
|
- lib/actual_db_schema/commands/base.rb
|
136
137
|
- lib/actual_db_schema/commands/list.rb
|
@@ -166,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
167
|
- !ruby/object:Gem::Version
|
167
168
|
version: '0'
|
168
169
|
requirements: []
|
169
|
-
rubygems_version: 3.3.
|
170
|
+
rubygems_version: 3.3.26
|
170
171
|
signing_key:
|
171
172
|
specification_version: 4
|
172
173
|
summary: Keep your DB and schema.rb consistent in dev branches.
|