umbrellio-sequel-plugins 0.11.0.143 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -4
- data/Gemfile +9 -0
- data/Gemfile.lock +50 -46
- data/lib/tasks/sequel/rollback_archived_migrations.rake +26 -0
- data/lib/tasks/sequel/rollback_missing_migrations.rake +5 -6
- data/lib/tasks/sequel/undo.rake +3 -3
- data/umbrellio-sequel-plugins.gemspec +1 -11
- metadata +7 -132
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87dd000032a7ff44d8bad71653d2663dcf1237ac0b57550542e99955f94ef089
|
4
|
+
data.tar.gz: a23cdcb226e924f641994e93b50e87e4f65d8f1af205b2437d548f93d04ebc3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8766ab1dd01298493e86325b906dd905af008f091bb07ae8ed1017571dc66a80131e31345a03e3fd35f744456c7aa43ec17a66554be9f867742539c40687064a
|
7
|
+
data.tar.gz: a11d6c78ae9aaf33b88d74b97bfc6ab6e79497fa0ebcb8ef22dc0782303964c4f4683cde30f7c8679f0ceec48918720ad439c3f0da0467534f4fa3dbf4745f1d
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
|
12
12
|
services:
|
13
13
|
postgres:
|
14
|
-
image: postgres:
|
14
|
+
image: postgres:14
|
15
15
|
env:
|
16
16
|
POSTGRES_USER: root
|
17
17
|
POSTGRES_HOST_AUTH_METHOD: trust
|
@@ -30,12 +30,12 @@ jobs:
|
|
30
30
|
strategy:
|
31
31
|
fail-fast: false
|
32
32
|
matrix:
|
33
|
-
ruby: ["2.7", "3.0", "3.1"]
|
33
|
+
ruby: ["2.7", "3.0", "3.1", "3.2"]
|
34
34
|
|
35
35
|
name: ${{ matrix.ruby }}
|
36
36
|
|
37
37
|
steps:
|
38
|
-
- uses: actions/checkout@
|
38
|
+
- uses: actions/checkout@v3
|
39
39
|
|
40
40
|
- uses: ruby/setup-ruby@v1
|
41
41
|
with:
|
@@ -58,7 +58,7 @@ jobs:
|
|
58
58
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
59
59
|
|
60
60
|
steps:
|
61
|
-
- uses: actions/checkout@
|
61
|
+
- uses: actions/checkout@v3
|
62
62
|
|
63
63
|
- uses: umbrellio/publish-ruby-gem-action@v1.0.4
|
64
64
|
with:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,90 +1,95 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
umbrellio-sequel-plugins (0.
|
4
|
+
umbrellio-sequel-plugins (0.12.0)
|
5
5
|
sequel
|
6
6
|
symbiont-ruby
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (7.0.
|
11
|
+
activesupport (7.0.6)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
15
15
|
tzinfo (~> 2.0)
|
16
16
|
ast (2.4.2)
|
17
17
|
coderay (1.1.3)
|
18
|
-
concurrent-ruby (1.
|
18
|
+
concurrent-ruby (1.2.2)
|
19
19
|
diff-lcs (1.5.0)
|
20
20
|
docile (1.4.0)
|
21
|
-
i18n (1.
|
21
|
+
i18n (1.14.1)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
|
-
json (2.6.
|
23
|
+
json (2.6.3)
|
24
24
|
method_source (1.0.0)
|
25
|
-
minitest (5.
|
25
|
+
minitest (5.18.1)
|
26
26
|
money (6.16.0)
|
27
27
|
i18n (>= 0.6.4, <= 2)
|
28
|
-
parallel (1.
|
29
|
-
parser (3.
|
28
|
+
parallel (1.23.0)
|
29
|
+
parser (3.2.2.3)
|
30
30
|
ast (~> 2.4.1)
|
31
|
-
|
32
|
-
|
31
|
+
racc
|
32
|
+
pg (1.5.3)
|
33
|
+
pry (0.14.2)
|
33
34
|
coderay (~> 1.1)
|
34
35
|
method_source (~> 1.0)
|
35
|
-
|
36
|
+
racc (1.7.1)
|
37
|
+
rack (3.0.8)
|
36
38
|
rainbow (3.1.1)
|
37
39
|
rake (13.0.6)
|
38
|
-
regexp_parser (2.
|
40
|
+
regexp_parser (2.8.1)
|
39
41
|
rexml (3.2.5)
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
42
|
+
rspec (3.12.0)
|
43
|
+
rspec-core (~> 3.12.0)
|
44
|
+
rspec-expectations (~> 3.12.0)
|
45
|
+
rspec-mocks (~> 3.12.0)
|
46
|
+
rspec-core (3.12.2)
|
47
|
+
rspec-support (~> 3.12.0)
|
48
|
+
rspec-expectations (3.12.3)
|
47
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
50
|
+
rspec-support (~> 3.12.0)
|
51
|
+
rspec-mocks (3.12.5)
|
50
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (1.
|
53
|
+
rspec-support (~> 3.12.0)
|
54
|
+
rspec-support (3.12.1)
|
55
|
+
rubocop (1.50.2)
|
54
56
|
json (~> 2.3)
|
55
57
|
parallel (~> 1.10)
|
56
|
-
parser (>= 3.
|
58
|
+
parser (>= 3.2.0.0)
|
57
59
|
rainbow (>= 2.2.2, < 4.0)
|
58
60
|
regexp_parser (>= 1.8, < 3.0)
|
59
61
|
rexml (>= 3.2.5, < 4.0)
|
60
|
-
rubocop-ast (>= 1.
|
62
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
61
63
|
ruby-progressbar (~> 1.7)
|
62
|
-
unicode-display_width (>=
|
63
|
-
rubocop-ast (1.
|
64
|
-
parser (>= 3.
|
65
|
-
rubocop-
|
66
|
-
rubocop (~> 1.
|
67
|
-
|
68
|
-
rubocop
|
64
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
65
|
+
rubocop-ast (1.29.0)
|
66
|
+
parser (>= 3.2.1.0)
|
67
|
+
rubocop-capybara (2.18.0)
|
68
|
+
rubocop (~> 1.41)
|
69
|
+
rubocop-config-umbrellio (1.50.0.85)
|
70
|
+
rubocop (~> 1.50.0)
|
71
|
+
rubocop-performance (~> 1.17.0)
|
72
|
+
rubocop-rails (~> 2.19.0)
|
69
73
|
rubocop-rake (~> 0.6.0)
|
70
|
-
rubocop-rspec (~> 2.
|
74
|
+
rubocop-rspec (~> 2.20.0)
|
71
75
|
rubocop-sequel (~> 0.3.3)
|
72
|
-
rubocop-performance (1.
|
76
|
+
rubocop-performance (1.17.1)
|
73
77
|
rubocop (>= 1.7.0, < 2.0)
|
74
78
|
rubocop-ast (>= 0.4.0)
|
75
|
-
rubocop-rails (2.
|
79
|
+
rubocop-rails (2.19.1)
|
76
80
|
activesupport (>= 4.2.0)
|
77
81
|
rack (>= 1.1)
|
78
|
-
rubocop (>= 1.
|
82
|
+
rubocop (>= 1.33.0, < 2.0)
|
79
83
|
rubocop-rake (0.6.0)
|
80
84
|
rubocop (~> 1.0)
|
81
|
-
rubocop-rspec (2.
|
82
|
-
rubocop (~> 1.
|
85
|
+
rubocop-rspec (2.20.0)
|
86
|
+
rubocop (~> 1.33)
|
87
|
+
rubocop-capybara (~> 2.17)
|
83
88
|
rubocop-sequel (0.3.4)
|
84
89
|
rubocop (~> 1.0)
|
85
|
-
ruby-progressbar (1.
|
86
|
-
sequel (5.
|
87
|
-
simplecov (0.
|
90
|
+
ruby-progressbar (1.13.0)
|
91
|
+
sequel (5.70.0)
|
92
|
+
simplecov (0.22.0)
|
88
93
|
docile (~> 1.1)
|
89
94
|
simplecov-html (~> 0.11)
|
90
95
|
simplecov_json_formatter (~> 0.1)
|
@@ -92,15 +97,14 @@ GEM
|
|
92
97
|
simplecov-lcov (0.8.0)
|
93
98
|
simplecov_json_formatter (0.1.4)
|
94
99
|
symbiont-ruby (0.7.0)
|
95
|
-
tzinfo (2.0.
|
100
|
+
tzinfo (2.0.6)
|
96
101
|
concurrent-ruby (~> 1.0)
|
97
|
-
unicode-display_width (2.
|
102
|
+
unicode-display_width (2.4.2)
|
98
103
|
|
99
104
|
PLATFORMS
|
100
105
|
ruby
|
101
106
|
|
102
107
|
DEPENDENCIES
|
103
|
-
bundler
|
104
108
|
money
|
105
109
|
pg
|
106
110
|
pry
|
@@ -112,4 +116,4 @@ DEPENDENCIES
|
|
112
116
|
umbrellio-sequel-plugins!
|
113
117
|
|
114
118
|
BUNDLED WITH
|
115
|
-
2.
|
119
|
+
2.4.15
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sequel/timestamp_migrator_undo_extension"
|
4
|
+
|
5
|
+
namespace :sequel do
|
6
|
+
desc "Rollback migrations that were applied earlier but are not present in current release"
|
7
|
+
task rollback_archived_migrations: :environment do
|
8
|
+
DB.log_info("Finding applied migrations not present in current release...")
|
9
|
+
|
10
|
+
archive_path = Pathname.new(ENV.fetch("ARCHIVE_PATH")).expand_path.join("db/migrate")
|
11
|
+
migrator = Sequel::TimestampMigrator.new(DB, archive_path, allow_missing_migration_files: true)
|
12
|
+
|
13
|
+
applied_migrations = migrator.applied_migrations.map(&:to_i)
|
14
|
+
filesystem_migrations = Rails.root.glob("db/migrate/*.rb").map { |x| File.basename(x).to_i }
|
15
|
+
missing_migrations = applied_migrations - filesystem_migrations
|
16
|
+
|
17
|
+
if missing_migrations.any?
|
18
|
+
missing_migrations.each do |migration|
|
19
|
+
DB.log_info("Rolling back migration #{migration}...")
|
20
|
+
migrator.undo(migration)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
DB.log_info("No migrations found")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -3,15 +3,14 @@
|
|
3
3
|
require "sequel/timestamp_migrator_undo_extension"
|
4
4
|
|
5
5
|
namespace :sequel do
|
6
|
-
|
6
|
+
desc "Rollback migrations that are absent in revision when deploying on staging"
|
7
7
|
task rollback_missing_migrations: :environment do
|
8
|
-
|
9
|
-
def extract_migrations(path)
|
8
|
+
extract_migrations = lambda do |path|
|
10
9
|
Dir.glob("#{path}/db/migrate/*.rb").map { |filename| File.basename(filename).to_i }
|
11
10
|
end
|
12
11
|
|
13
|
-
old_migrations = extract_migrations(ENV.fetch("OLD_RELEASE"))
|
14
|
-
new_migrations = extract_migrations(ENV.fetch("NEW_RELEASE"))
|
12
|
+
old_migrations = extract_migrations.call(ENV.fetch("OLD_RELEASE"))
|
13
|
+
new_migrations = extract_migrations.call(ENV.fetch("NEW_RELEASE"))
|
15
14
|
migrations_to_rollback = old_migrations - new_migrations
|
16
15
|
|
17
16
|
next if migrations_to_rollback.empty?
|
@@ -19,7 +18,7 @@ namespace :sequel do
|
|
19
18
|
puts "Rolling back migrations:"
|
20
19
|
puts migrations_to_rollback
|
21
20
|
|
22
|
-
path =
|
21
|
+
path = Rails.root.join("db/migrate")
|
23
22
|
migrator = Sequel::TimestampMigrator.new(DB, path, allow_missing_migration_files: true)
|
24
23
|
applied_migrations = migrator.applied_migrations.map(&:to_i)
|
25
24
|
migrations = applied_migrations.select { |m| m.in?(migrations_to_rollback) }.sort.reverse
|
data/lib/tasks/sequel/undo.rake
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
require "sequel/timestamp_migrator_undo_extension"
|
4
4
|
|
5
5
|
namespace :sequel do
|
6
|
-
|
6
|
+
desc "Rollback a specific migration"
|
7
7
|
task undo: :environment do
|
8
|
-
version = ENV["VERSION"]
|
8
|
+
version = ENV["VERSION"]&.to_i
|
9
9
|
raise "VERSION is required" unless version
|
10
10
|
|
11
|
-
path =
|
11
|
+
path = Rails.root.join("db/migrate")
|
12
12
|
migrator = Sequel::TimestampMigrator.new(DB, path, allow_missing_migration_files: true)
|
13
13
|
migrator.undo(version)
|
14
14
|
end
|
@@ -4,7 +4,7 @@ lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
gem_version = "0.
|
7
|
+
gem_version = "0.12.0"
|
8
8
|
|
9
9
|
if ENV.fetch("PUBLISH_JOB", nil)
|
10
10
|
release_version = "#{gem_version}.#{ENV.fetch("GITHUB_RUN_NUMBER")}"
|
@@ -26,14 +26,4 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_runtime_dependency "sequel"
|
28
28
|
spec.add_runtime_dependency "symbiont-ruby"
|
29
|
-
|
30
|
-
spec.add_development_dependency "bundler"
|
31
|
-
spec.add_development_dependency "money"
|
32
|
-
spec.add_development_dependency "pg"
|
33
|
-
spec.add_development_dependency "pry"
|
34
|
-
spec.add_development_dependency "rake"
|
35
|
-
spec.add_development_dependency "rspec"
|
36
|
-
spec.add_development_dependency "rubocop-config-umbrellio"
|
37
|
-
spec.add_development_dependency "simplecov"
|
38
|
-
spec.add_development_dependency "simplecov-lcov"
|
39
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umbrellio-sequel-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Umbrellio
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -38,132 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: money
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pg
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rake
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-config-umbrellio
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: simplecov
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: simplecov-lcov
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
41
|
description: A colletion of sequel plugins by Umbrellio
|
168
42
|
email:
|
169
43
|
- oss@umbrellio.biz
|
@@ -201,6 +75,7 @@ files:
|
|
201
75
|
- lib/sequel/plugins/upsert.rb
|
202
76
|
- lib/sequel/plugins/with_lock.rb
|
203
77
|
- lib/sequel/timestamp_migrator_undo_extension.rb
|
78
|
+
- lib/tasks/sequel/rollback_archived_migrations.rake
|
204
79
|
- lib/tasks/sequel/rollback_missing_migrations.rake
|
205
80
|
- lib/tasks/sequel/undo.rake
|
206
81
|
- lib/umbrellio-sequel-plugins.rb
|
@@ -213,7 +88,7 @@ homepage: https://github.com/umbrellio/umbrellio-sequel-plugins
|
|
213
88
|
licenses:
|
214
89
|
- MIT
|
215
90
|
metadata: {}
|
216
|
-
post_install_message:
|
91
|
+
post_install_message:
|
217
92
|
rdoc_options: []
|
218
93
|
require_paths:
|
219
94
|
- lib
|
@@ -228,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
103
|
- !ruby/object:Gem::Version
|
229
104
|
version: '0'
|
230
105
|
requirements: []
|
231
|
-
rubygems_version: 3.
|
232
|
-
signing_key:
|
106
|
+
rubygems_version: 3.4.15
|
107
|
+
signing_key:
|
233
108
|
specification_version: 4
|
234
109
|
summary: Sequel plugins
|
235
110
|
test_files: []
|