travis-backup-for-v3 0.1.0 → 0.1.2
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/.gitignore +2 -1
- data/Gemfile.lock +214 -151
- data/README.md +4 -2
- data/db/schema.sql +0 -2
- data/lib/backup/remove_specified/remove_with_all_dependencies.rb +6 -0
- data/lib/backup/save_nullified_rels_to_file.rb +2 -2
- data/lib/config.rb +6 -3
- data/lib/models/deleted_build.rb +0 -9
- data/lib/models/deleted_build_config.rb +0 -2
- data/lib/models/deleted_commit.rb +0 -6
- data/lib/models/deleted_job.rb +0 -2
- data/lib/models/deleted_job_config.rb +0 -2
- data/lib/models/deleted_pull_request.rb +0 -4
- data/lib/models/deleted_request.rb +0 -10
- data/lib/models/deleted_request_config.rb +0 -2
- data/lib/models/deleted_request_raw_config.rb +0 -2
- data/lib/models/deleted_request_yaml_config.rb +0 -2
- data/lib/models/deleted_stage.rb +0 -2
- data/lib/models/deleted_tag.rb +0 -6
- data/lib/models/message.rb +2 -0
- data/lib/models/user.rb +1 -0
- data/travis-backup-for-v3.gemspec +12 -12
- metadata +27 -35
- data/workspace.code-workspace +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b266edee254a754a11d020786c9d1cfaef23cbf774987c26912fc7324432ea4
|
|
4
|
+
data.tar.gz: 1118b310ab819b50da380cecf960f835409cb839eb35ab525875fd074448f297
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c161f1f224135e12809cc944bc6c8e7e6bc1b5b9323413149cc9f25e71e8e28cdfbd49965313101db3086f6fb6500047319487d9523974979aab589540ee5155
|
|
7
|
+
data.tar.gz: edcf43f2691e0bb218e0b08d5592f91e34b339e1946d3cefe1146a7ab68ac785ad13b37bd1eb056a53f04c27e52dc18cc2725c03e6f125a2caa5d4ab5b448880
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -2,202 +2,265 @@ PATH
|
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
4
|
travis-backup-for-v3 (0.1.0)
|
|
5
|
-
activerecord
|
|
5
|
+
activerecord (~> 7)
|
|
6
6
|
bootsnap
|
|
7
7
|
pg
|
|
8
8
|
pry
|
|
9
|
-
rails
|
|
9
|
+
rails (~> 7)
|
|
10
10
|
tzinfo-data
|
|
11
11
|
|
|
12
12
|
GEM
|
|
13
13
|
remote: https://rubygems.org/
|
|
14
14
|
specs:
|
|
15
|
-
actioncable (
|
|
16
|
-
actionpack (=
|
|
17
|
-
activesupport (=
|
|
15
|
+
actioncable (7.2.2.1)
|
|
16
|
+
actionpack (= 7.2.2.1)
|
|
17
|
+
activesupport (= 7.2.2.1)
|
|
18
18
|
nio4r (~> 2.0)
|
|
19
19
|
websocket-driver (>= 0.6.1)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
zeitwerk (~> 2.6)
|
|
21
|
+
actionmailbox (7.2.2.1)
|
|
22
|
+
actionpack (= 7.2.2.1)
|
|
23
|
+
activejob (= 7.2.2.1)
|
|
24
|
+
activerecord (= 7.2.2.1)
|
|
25
|
+
activestorage (= 7.2.2.1)
|
|
26
|
+
activesupport (= 7.2.2.1)
|
|
27
|
+
mail (>= 2.8.0)
|
|
28
|
+
actionmailer (7.2.2.1)
|
|
29
|
+
actionpack (= 7.2.2.1)
|
|
30
|
+
actionview (= 7.2.2.1)
|
|
31
|
+
activejob (= 7.2.2.1)
|
|
32
|
+
activesupport (= 7.2.2.1)
|
|
33
|
+
mail (>= 2.8.0)
|
|
34
|
+
rails-dom-testing (~> 2.2)
|
|
35
|
+
actionpack (7.2.2.1)
|
|
36
|
+
actionview (= 7.2.2.1)
|
|
37
|
+
activesupport (= 7.2.2.1)
|
|
38
|
+
nokogiri (>= 1.8.5)
|
|
39
|
+
racc
|
|
40
|
+
rack (>= 2.2.4, < 3.2)
|
|
41
|
+
rack-session (>= 1.0.1)
|
|
38
42
|
rack-test (>= 0.6.3)
|
|
39
|
-
rails-dom-testing (~> 2.
|
|
40
|
-
rails-html-sanitizer (~> 1.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
rails-dom-testing (~> 2.2)
|
|
44
|
+
rails-html-sanitizer (~> 1.6)
|
|
45
|
+
useragent (~> 0.16)
|
|
46
|
+
actiontext (7.2.2.1)
|
|
47
|
+
actionpack (= 7.2.2.1)
|
|
48
|
+
activerecord (= 7.2.2.1)
|
|
49
|
+
activestorage (= 7.2.2.1)
|
|
50
|
+
activesupport (= 7.2.2.1)
|
|
51
|
+
globalid (>= 0.6.0)
|
|
46
52
|
nokogiri (>= 1.8.5)
|
|
47
|
-
actionview (
|
|
48
|
-
activesupport (=
|
|
53
|
+
actionview (7.2.2.1)
|
|
54
|
+
activesupport (= 7.2.2.1)
|
|
49
55
|
builder (~> 3.1)
|
|
50
|
-
erubi (~> 1.
|
|
51
|
-
rails-dom-testing (~> 2.
|
|
52
|
-
rails-html-sanitizer (~> 1.
|
|
53
|
-
activejob (
|
|
54
|
-
activesupport (=
|
|
56
|
+
erubi (~> 1.11)
|
|
57
|
+
rails-dom-testing (~> 2.2)
|
|
58
|
+
rails-html-sanitizer (~> 1.6)
|
|
59
|
+
activejob (7.2.2.1)
|
|
60
|
+
activesupport (= 7.2.2.1)
|
|
55
61
|
globalid (>= 0.3.6)
|
|
56
|
-
activemodel (
|
|
57
|
-
activesupport (=
|
|
58
|
-
activerecord (
|
|
59
|
-
activemodel (=
|
|
60
|
-
activesupport (=
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
activesupport (
|
|
69
|
-
|
|
62
|
+
activemodel (7.2.2.1)
|
|
63
|
+
activesupport (= 7.2.2.1)
|
|
64
|
+
activerecord (7.2.2.1)
|
|
65
|
+
activemodel (= 7.2.2.1)
|
|
66
|
+
activesupport (= 7.2.2.1)
|
|
67
|
+
timeout (>= 0.4.0)
|
|
68
|
+
activestorage (7.2.2.1)
|
|
69
|
+
actionpack (= 7.2.2.1)
|
|
70
|
+
activejob (= 7.2.2.1)
|
|
71
|
+
activerecord (= 7.2.2.1)
|
|
72
|
+
activesupport (= 7.2.2.1)
|
|
73
|
+
marcel (~> 1.0)
|
|
74
|
+
activesupport (7.2.2.1)
|
|
75
|
+
base64
|
|
76
|
+
benchmark (>= 0.3)
|
|
77
|
+
bigdecimal
|
|
78
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
79
|
+
connection_pool (>= 2.2.5)
|
|
80
|
+
drb
|
|
70
81
|
i18n (>= 1.6, < 2)
|
|
82
|
+
logger (>= 1.4.2)
|
|
71
83
|
minitest (>= 5.1)
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
securerandom (>= 0.3)
|
|
85
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
74
86
|
ast (2.4.2)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
base64 (0.2.0)
|
|
88
|
+
benchmark (0.4.0)
|
|
89
|
+
bigdecimal (3.1.9)
|
|
90
|
+
bootsnap (1.18.4)
|
|
91
|
+
msgpack (~> 1.2)
|
|
92
|
+
brakeman (7.0.0)
|
|
93
|
+
racc
|
|
94
|
+
builder (3.3.0)
|
|
79
95
|
byebug (11.1.3)
|
|
80
96
|
coderay (1.1.3)
|
|
81
|
-
concurrent-ruby (1.
|
|
97
|
+
concurrent-ruby (1.3.4)
|
|
98
|
+
connection_pool (2.5.0)
|
|
82
99
|
crass (1.0.6)
|
|
83
|
-
database_cleaner-active_record (2.0
|
|
100
|
+
database_cleaner-active_record (2.2.0)
|
|
84
101
|
activerecord (>= 5.a)
|
|
85
102
|
database_cleaner-core (~> 2.0.0)
|
|
86
103
|
database_cleaner-core (2.0.1)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
date (3.4.1)
|
|
105
|
+
diff-lcs (1.5.1)
|
|
106
|
+
drb (2.2.1)
|
|
107
|
+
erubi (1.13.1)
|
|
108
|
+
factory_bot (6.5.0)
|
|
90
109
|
activesupport (>= 5.0.0)
|
|
91
|
-
ffi (1.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
ffi (1.17.1-arm64-darwin)
|
|
111
|
+
ffi (1.17.1-x86_64-linux-gnu)
|
|
112
|
+
globalid (1.2.1)
|
|
113
|
+
activesupport (>= 6.1)
|
|
114
|
+
i18n (1.14.6)
|
|
95
115
|
concurrent-ruby (~> 1.0)
|
|
96
|
-
|
|
97
|
-
|
|
116
|
+
io-console (0.8.0)
|
|
117
|
+
irb (1.14.3)
|
|
118
|
+
rdoc (>= 4.0.0)
|
|
119
|
+
reline (>= 0.4.2)
|
|
120
|
+
json (2.9.1)
|
|
121
|
+
language_server-protocol (3.17.0.3)
|
|
122
|
+
listen (3.9.0)
|
|
98
123
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
99
124
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
100
|
-
|
|
125
|
+
logger (1.6.5)
|
|
126
|
+
loofah (2.24.0)
|
|
101
127
|
crass (~> 1.0.2)
|
|
102
|
-
nokogiri (>= 1.
|
|
103
|
-
mail (2.
|
|
128
|
+
nokogiri (>= 1.12.0)
|
|
129
|
+
mail (2.8.1)
|
|
104
130
|
mini_mime (>= 0.1.1)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
131
|
+
net-imap
|
|
132
|
+
net-pop
|
|
133
|
+
net-smtp
|
|
134
|
+
marcel (1.0.4)
|
|
135
|
+
method_source (1.1.0)
|
|
136
|
+
mini_mime (1.1.5)
|
|
137
|
+
minitest (5.25.4)
|
|
138
|
+
msgpack (1.7.5)
|
|
139
|
+
net-imap (0.5.5)
|
|
140
|
+
date
|
|
141
|
+
net-protocol
|
|
142
|
+
net-pop (0.1.2)
|
|
143
|
+
net-protocol
|
|
144
|
+
net-protocol (0.2.2)
|
|
145
|
+
timeout
|
|
146
|
+
net-smtp (0.5.0)
|
|
147
|
+
net-protocol
|
|
148
|
+
nio4r (2.7.4)
|
|
149
|
+
nokogiri (1.18.1-arm64-darwin)
|
|
150
|
+
racc (~> 1.4)
|
|
151
|
+
nokogiri (1.18.1-x86_64-linux-gnu)
|
|
112
152
|
racc (~> 1.4)
|
|
113
|
-
parallel (1.
|
|
114
|
-
parser (3.
|
|
153
|
+
parallel (1.26.3)
|
|
154
|
+
parser (3.3.6.0)
|
|
115
155
|
ast (~> 2.4.1)
|
|
116
|
-
|
|
117
|
-
|
|
156
|
+
racc
|
|
157
|
+
pg (1.5.9)
|
|
158
|
+
pry (0.15.2)
|
|
118
159
|
coderay (~> 1.1)
|
|
119
160
|
method_source (~> 1.0)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
161
|
+
psych (5.2.2)
|
|
162
|
+
date
|
|
163
|
+
stringio
|
|
164
|
+
racc (1.8.1)
|
|
165
|
+
rack (3.1.8)
|
|
166
|
+
rack-session (2.1.0)
|
|
167
|
+
base64 (>= 0.1.0)
|
|
168
|
+
rack (>= 3.0.0)
|
|
169
|
+
rack-test (2.2.0)
|
|
170
|
+
rack (>= 1.3)
|
|
171
|
+
rackup (2.2.1)
|
|
172
|
+
rack (>= 3)
|
|
173
|
+
rails (7.2.2.1)
|
|
174
|
+
actioncable (= 7.2.2.1)
|
|
175
|
+
actionmailbox (= 7.2.2.1)
|
|
176
|
+
actionmailer (= 7.2.2.1)
|
|
177
|
+
actionpack (= 7.2.2.1)
|
|
178
|
+
actiontext (= 7.2.2.1)
|
|
179
|
+
actionview (= 7.2.2.1)
|
|
180
|
+
activejob (= 7.2.2.1)
|
|
181
|
+
activemodel (= 7.2.2.1)
|
|
182
|
+
activerecord (= 7.2.2.1)
|
|
183
|
+
activestorage (= 7.2.2.1)
|
|
184
|
+
activesupport (= 7.2.2.1)
|
|
136
185
|
bundler (>= 1.15.0)
|
|
137
|
-
railties (=
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
186
|
+
railties (= 7.2.2.1)
|
|
187
|
+
rails-dom-testing (2.2.0)
|
|
188
|
+
activesupport (>= 5.0.0)
|
|
189
|
+
minitest
|
|
141
190
|
nokogiri (>= 1.6)
|
|
142
|
-
rails-html-sanitizer (1.
|
|
143
|
-
loofah (~> 2.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
191
|
+
rails-html-sanitizer (1.6.2)
|
|
192
|
+
loofah (~> 2.21)
|
|
193
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
194
|
+
railties (7.2.2.1)
|
|
195
|
+
actionpack (= 7.2.2.1)
|
|
196
|
+
activesupport (= 7.2.2.1)
|
|
197
|
+
irb (~> 1.13)
|
|
198
|
+
rackup (>= 1.0.0)
|
|
199
|
+
rake (>= 12.2)
|
|
200
|
+
thor (~> 1.0, >= 1.2.2)
|
|
201
|
+
zeitwerk (~> 2.6)
|
|
202
|
+
rainbow (3.1.1)
|
|
203
|
+
rake (13.2.1)
|
|
204
|
+
rb-fsevent (0.11.2)
|
|
205
|
+
rb-inotify (0.11.1)
|
|
154
206
|
ffi (~> 1.0)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
207
|
+
rdoc (6.10.0)
|
|
208
|
+
psych (>= 4.0.0)
|
|
209
|
+
regexp_parser (2.10.0)
|
|
210
|
+
reline (0.6.0)
|
|
211
|
+
io-console (~> 0.5)
|
|
212
|
+
rspec-core (3.13.2)
|
|
213
|
+
rspec-support (~> 3.13.0)
|
|
214
|
+
rspec-expectations (3.13.3)
|
|
158
215
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
159
|
-
rspec-support (~> 3.
|
|
160
|
-
rspec-mocks (3.
|
|
216
|
+
rspec-support (~> 3.13.0)
|
|
217
|
+
rspec-mocks (3.13.2)
|
|
161
218
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
162
|
-
rspec-support (~> 3.
|
|
163
|
-
rspec-rails (
|
|
164
|
-
actionpack (>=
|
|
165
|
-
activesupport (>=
|
|
166
|
-
railties (>=
|
|
167
|
-
rspec-core (~> 3.
|
|
168
|
-
rspec-expectations (~> 3.
|
|
169
|
-
rspec-mocks (~> 3.
|
|
170
|
-
rspec-support (~> 3.
|
|
171
|
-
rspec-support (3.
|
|
172
|
-
rubocop (
|
|
173
|
-
|
|
219
|
+
rspec-support (~> 3.13.0)
|
|
220
|
+
rspec-rails (7.1.0)
|
|
221
|
+
actionpack (>= 7.0)
|
|
222
|
+
activesupport (>= 7.0)
|
|
223
|
+
railties (>= 7.0)
|
|
224
|
+
rspec-core (~> 3.13)
|
|
225
|
+
rspec-expectations (~> 3.13)
|
|
226
|
+
rspec-mocks (~> 3.13)
|
|
227
|
+
rspec-support (~> 3.13)
|
|
228
|
+
rspec-support (3.13.2)
|
|
229
|
+
rubocop (1.70.0)
|
|
230
|
+
json (~> 2.3)
|
|
231
|
+
language_server-protocol (>= 3.17.0)
|
|
174
232
|
parallel (~> 1.10)
|
|
175
|
-
parser (>= 2
|
|
233
|
+
parser (>= 3.3.0.2)
|
|
176
234
|
rainbow (>= 2.2.2, < 4.0)
|
|
235
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
236
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
|
177
237
|
ruby-progressbar (~> 1.7)
|
|
178
|
-
unicode-display_width (>=
|
|
179
|
-
rubocop-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
thor (1.1.0)
|
|
190
|
-
tzinfo (2.0.4)
|
|
238
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
239
|
+
rubocop-ast (1.37.0)
|
|
240
|
+
parser (>= 3.3.1.0)
|
|
241
|
+
rubocop-rspec (3.3.0)
|
|
242
|
+
rubocop (~> 1.61)
|
|
243
|
+
ruby-progressbar (1.13.0)
|
|
244
|
+
securerandom (0.4.1)
|
|
245
|
+
stringio (3.1.2)
|
|
246
|
+
thor (1.3.2)
|
|
247
|
+
timeout (0.4.3)
|
|
248
|
+
tzinfo (2.0.6)
|
|
191
249
|
concurrent-ruby (~> 1.0)
|
|
192
|
-
tzinfo-data (1.
|
|
250
|
+
tzinfo-data (1.2024.2)
|
|
193
251
|
tzinfo (>= 1.0.0)
|
|
194
|
-
unicode-display_width (1.
|
|
195
|
-
|
|
252
|
+
unicode-display_width (3.1.4)
|
|
253
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
254
|
+
unicode-emoji (4.0.4)
|
|
255
|
+
useragent (0.16.11)
|
|
256
|
+
websocket-driver (0.7.7)
|
|
257
|
+
base64
|
|
196
258
|
websocket-extensions (>= 0.1.0)
|
|
197
259
|
websocket-extensions (0.1.5)
|
|
198
|
-
zeitwerk (2.
|
|
260
|
+
zeitwerk (2.7.1)
|
|
199
261
|
|
|
200
262
|
PLATFORMS
|
|
263
|
+
arm64-darwin-22
|
|
201
264
|
x86_64-linux
|
|
202
265
|
|
|
203
266
|
DEPENDENCIES
|
|
@@ -207,9 +270,9 @@ DEPENDENCIES
|
|
|
207
270
|
factory_bot
|
|
208
271
|
listen
|
|
209
272
|
rspec-rails
|
|
210
|
-
rubocop
|
|
273
|
+
rubocop
|
|
211
274
|
rubocop-rspec
|
|
212
275
|
travis-backup-for-v3!
|
|
213
276
|
|
|
214
277
|
BUNDLED WITH
|
|
215
|
-
2.
|
|
278
|
+
2.4.19
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# README
|
|
2
2
|
|
|
3
|
-
*travis-backup-for-v3* is an application that helps with housekeeping and backup for Travis CI database v3.0.
|
|
3
|
+
*travis-backup-for-v3* is an application that helps with housekeeping and backup for Travis CI database v3.0. By default it removes requests and builds with their dependencies, as long as they are older than given threshold says (and backups them in files, if this option is active). It can also be used to remove specified users, organizations or repositories with their dependencies.
|
|
4
4
|
|
|
5
5
|
### Installation and run
|
|
6
6
|
|
|
@@ -55,6 +55,8 @@ backup.run(repo_id: 1)
|
|
|
55
55
|
|
|
56
56
|
#### Special modes
|
|
57
57
|
|
|
58
|
+
Using `--user_id`, `--org_id` or `--repo_id` flag without setting `--threshold` results in removing the specified user/organization/repository with all its dependencies. It can be combined with `--backup` flag in order to save removed data in files.
|
|
59
|
+
|
|
58
60
|
Using `--dry_run` flag you can check which data would be removed by gem, but without removing them actually. Instead of that reports will be printed on standard output. This flag can be also combined with special modes.
|
|
59
61
|
|
|
60
62
|
### Configuration options
|
|
@@ -97,4 +99,4 @@ To make tests working properly you should also ensure database connection string
|
|
|
97
99
|
|
|
98
100
|
### Ruby version
|
|
99
101
|
|
|
100
|
-
2.
|
|
102
|
+
3.2.0
|
data/db/schema.sql
CHANGED
|
@@ -4,13 +4,11 @@ CREATE SCHEMA public;
|
|
|
4
4
|
|
|
5
5
|
SET statement_timeout = 0;
|
|
6
6
|
SET lock_timeout = 0;
|
|
7
|
-
SET idle_in_transaction_session_timeout = 0;
|
|
8
7
|
SET client_encoding = 'UTF8';
|
|
9
8
|
SET standard_conforming_strings = on;
|
|
10
9
|
SELECT pg_catalog.set_config('search_path', '', false);
|
|
11
10
|
SET check_function_bodies = false;
|
|
12
11
|
SET client_min_messages = warning;
|
|
13
|
-
SET row_security = off;
|
|
14
12
|
|
|
15
13
|
--
|
|
16
14
|
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
|
@@ -14,6 +14,7 @@ class Backup
|
|
|
14
14
|
include Shared
|
|
15
15
|
|
|
16
16
|
def remove_user_with_dependencies(user_id)
|
|
17
|
+
fix_installations(user_id)
|
|
17
18
|
remove_entry_with_dependencies(:user, user_id)
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -27,6 +28,11 @@ class Backup
|
|
|
27
28
|
|
|
28
29
|
private
|
|
29
30
|
|
|
31
|
+
def fix_installations(user_id)
|
|
32
|
+
Installation.where(added_by_id: user_id).update!(added_by_id: 0)
|
|
33
|
+
Installation.where(removed_by_id: user_id).update!(removed_by_id: 0)
|
|
34
|
+
end
|
|
35
|
+
|
|
30
36
|
def remove_entry_with_dependencies(model_name, id)
|
|
31
37
|
@subfolder = "#{model_name}_#{id}_#{current_time_for_subfolder}"
|
|
32
38
|
entry = Model.get_model(model_name).find(id)
|
|
@@ -7,7 +7,7 @@ module SaveNullifiedRelsToFile
|
|
|
7
7
|
@file_index = 1
|
|
8
8
|
|
|
9
9
|
rels_hash.each do |name, rels|
|
|
10
|
-
rels&.compact&.each_slice(@config.limit.to_i) do |rels_batch|
|
|
10
|
+
rels&.compact&.sort{|a, b| a.to_s <=> b.to_s}&.each_slice(@config.limit.to_i) do |rels_batch|
|
|
11
11
|
save_rels_batch_to_file(name, rels_batch)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -18,7 +18,7 @@ module SaveNullifiedRelsToFile
|
|
|
18
18
|
|
|
19
19
|
export = {}
|
|
20
20
|
export[:table_name] = model.table_name
|
|
21
|
-
export[:nullified_relationships]
|
|
21
|
+
export[:nullified_relationships]
|
|
22
22
|
|
|
23
23
|
content = JSON.pretty_generate(export)
|
|
24
24
|
file_name = "nullified_relationships/build_#{@file_index}.json"
|
data/lib/config.rb
CHANGED
|
@@ -131,7 +131,8 @@ class Config
|
|
|
131
131
|
def check_values
|
|
132
132
|
if !@move_logs && !@remove_orphans && !@threshold && !@user_id && !@org_id && !@repo_id && !@load_from_files
|
|
133
133
|
message = abort_message("Please provide the threshold argument. Data younger than it will be omitted. " +
|
|
134
|
-
"Threshold defines number of months from now."
|
|
134
|
+
"Threshold defines number of months from now. Alternatively you can define user_id, org_id or repo_id " +
|
|
135
|
+
"to remove whole user, organization or repository with all dependencies.")
|
|
135
136
|
abort message
|
|
136
137
|
end
|
|
137
138
|
|
|
@@ -151,9 +152,11 @@ class Config
|
|
|
151
152
|
|
|
152
153
|
def abort_message(intro)
|
|
153
154
|
"\n#{intro}\n\nExample usage:\n"+
|
|
154
|
-
"\n $ bin/travis_backup 'postgres://my_database_url' --threshold 6
|
|
155
|
+
"\n $ bin/travis_backup 'postgres://my_database_url' --threshold 6" +
|
|
156
|
+
"\n $ bin/travis_backup 'postgres://my_database_url' --user_id 1\n" +
|
|
155
157
|
"\nor using in code:\n" +
|
|
156
|
-
"\n Backup.new(database_url: 'postgres://my_database_url', threshold: 6)
|
|
158
|
+
"\n Backup.new(database_url: 'postgres://my_database_url', threshold: 6)" +
|
|
159
|
+
"\n Backup.new(database_url: 'postgres://my_database_url', user_id: 1)\n" +
|
|
157
160
|
"\nYou can also set it using environment variables or configuration files.\n"
|
|
158
161
|
end
|
|
159
162
|
|
data/lib/models/deleted_build.rb
CHANGED
|
@@ -14,16 +14,7 @@ class DeletedBuild < Model
|
|
|
14
14
|
belongs_to :build_config, foreign_key: :config_id, class_name: 'BuildConfig'
|
|
15
15
|
self.primary_key = 'id'
|
|
16
16
|
|
|
17
|
-
# has_many :jobs, -> { order('id') }, as: :source, dependent: :destroy
|
|
18
|
-
# has_many :repos_for_that_this_build_is_current, foreign_key: :current_build_id, dependent: :destroy, class_name: 'Repository'
|
|
19
|
-
# has_many :repos_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'Repository'
|
|
20
|
-
# has_many :tags_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'Tag'
|
|
21
|
-
# has_many :branches_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'Branch'
|
|
22
|
-
# has_many :stages
|
|
23
17
|
|
|
24
|
-
# has_many :deleted_jobs, -> { order('id') }, as: :source, dependent: :destroy
|
|
25
|
-
# has_many :deleted_tags_for_that_this_build_is_last, foreign_key: :last_build_id, class_name: 'DeletedTag'
|
|
26
|
-
# has_many :deleted_stages
|
|
27
18
|
|
|
28
19
|
# def self.default_dependencies_symbols_to_nullify
|
|
29
20
|
# [
|
|
@@ -7,11 +7,5 @@ class DeletedCommit < Model
|
|
|
7
7
|
belongs_to :repository
|
|
8
8
|
belongs_to :tag
|
|
9
9
|
self.primary_key = 'id'
|
|
10
|
-
# has_many :builds
|
|
11
|
-
# has_many :jobs
|
|
12
|
-
# has_many :requests
|
|
13
10
|
|
|
14
|
-
# has_many :deleted_builds
|
|
15
|
-
# has_many :deleted_jobs
|
|
16
|
-
# has_many :deleted_requests
|
|
17
11
|
end
|
data/lib/models/deleted_job.rb
CHANGED
|
@@ -13,14 +13,4 @@ class DeletedRequest < Model
|
|
|
13
13
|
belongs_to :request_yaml_configs
|
|
14
14
|
belongs_to :request_configs
|
|
15
15
|
self.primary_key = 'id'
|
|
16
|
-
# has_many :abuses
|
|
17
|
-
# has_many :messages, as: :subject
|
|
18
|
-
# has_many :jobs, as: :source
|
|
19
|
-
# has_many :builds
|
|
20
|
-
# has_many :request_payloads
|
|
21
|
-
# has_many :request_raw_configurations
|
|
22
|
-
# has_many :deleted_jobs, as: :source
|
|
23
|
-
# has_many :deleted_builds
|
|
24
|
-
# has_many :deleted_request_payloads
|
|
25
|
-
# has_many :deleted_request_raw_configurations
|
|
26
16
|
end
|
|
@@ -5,6 +5,4 @@ require 'model'
|
|
|
5
5
|
class DeletedRequestYamlConfig < Model
|
|
6
6
|
belongs_to :repository
|
|
7
7
|
self.primary_key = 'id'
|
|
8
|
-
# has_many :requests, foreign_key: :yaml_config_id, class_name: 'Request'
|
|
9
|
-
# has_many :deleted_requests, foreign_key: :yaml_config_id, class_name: 'DeletedRequest'
|
|
10
8
|
end
|
data/lib/models/deleted_stage.rb
CHANGED
data/lib/models/deleted_tag.rb
CHANGED
|
@@ -6,10 +6,4 @@ class DeletedTag < Model
|
|
|
6
6
|
belongs_to :last_build, foreign_key: :last_build_id, class_name: 'Build'
|
|
7
7
|
belongs_to :repository
|
|
8
8
|
self.primary_key = 'id'
|
|
9
|
-
# has_many :builds
|
|
10
|
-
# has_many :commits
|
|
11
|
-
# has_many :requests
|
|
12
|
-
# has_many :deleted_builds
|
|
13
|
-
# has_many :deleted_commits
|
|
14
|
-
# has_many :deleted_requests
|
|
15
9
|
end
|
data/lib/models/message.rb
CHANGED
data/lib/models/user.rb
CHANGED
|
@@ -10,6 +10,7 @@ class User < Model
|
|
|
10
10
|
has_many :requests_for_that_this_user_is_owner, as: :owner, class_name: 'Request'
|
|
11
11
|
has_many :abuses, as: :owner
|
|
12
12
|
has_many :subscriptions, as: :owner
|
|
13
|
+
has_many :installations, as: :owner
|
|
13
14
|
has_many :owner_groups, as: :owner
|
|
14
15
|
has_many :trials, as: :owner
|
|
15
16
|
has_many :trial_allowances, as: :creator
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'travis-backup-for-v3'
|
|
3
|
-
s.version = '0.1.
|
|
3
|
+
s.version = '0.1.2'
|
|
4
4
|
s.summary = 'Travis CI backup tool'
|
|
5
5
|
s.authors = ['Karol Selak']
|
|
6
|
-
s.required_ruby_version = Gem::Requirement.new(
|
|
7
|
-
s.files = Dir.chdir(File.expand_path(
|
|
6
|
+
s.required_ruby_version = Gem::Requirement.new('>= 3.2.0')
|
|
7
|
+
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
8
8
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
9
9
|
end
|
|
10
|
-
s.executables
|
|
11
|
-
s.
|
|
12
|
-
s.license
|
|
10
|
+
s.executables << 'travis_backup_for_v3'
|
|
11
|
+
s.require_path = 'lib'
|
|
12
|
+
s.license = 'Beerware'
|
|
13
13
|
|
|
14
|
-
s.add_dependency 'activerecord'
|
|
14
|
+
s.add_dependency 'activerecord', '~> 7'
|
|
15
15
|
s.add_dependency 'pg'
|
|
16
16
|
s.add_dependency 'pry'
|
|
17
|
-
s.add_dependency 'rails'
|
|
17
|
+
s.add_dependency 'rails', '~> 7'
|
|
18
18
|
|
|
19
19
|
s.add_dependency 'bootsnap'
|
|
20
20
|
s.add_dependency 'tzinfo-data'
|
|
21
21
|
|
|
22
22
|
s.add_development_dependency 'brakeman'
|
|
23
23
|
s.add_development_dependency 'byebug'
|
|
24
|
+
s.add_development_dependency 'database_cleaner-active_record'
|
|
24
25
|
s.add_development_dependency 'factory_bot'
|
|
25
|
-
s.add_development_dependency 'rspec-rails'
|
|
26
26
|
s.add_development_dependency 'listen'
|
|
27
|
-
s.add_development_dependency '
|
|
27
|
+
s.add_development_dependency 'rspec-rails'
|
|
28
|
+
s.add_development_dependency 'rubocop'
|
|
28
29
|
s.add_development_dependency 'rubocop-rspec'
|
|
29
|
-
|
|
30
|
-
end
|
|
30
|
+
end
|
metadata
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: travis-backup-for-v3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Karol Selak
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-12-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '7'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '7'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: pg
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -56,16 +56,16 @@ dependencies:
|
|
|
56
56
|
name: rails
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '7'
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '7'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: bootsnap
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -123,7 +123,7 @@ dependencies:
|
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
|
-
name:
|
|
126
|
+
name: database_cleaner-active_record
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
|
129
129
|
- - ">="
|
|
@@ -137,7 +137,7 @@ dependencies:
|
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
140
|
+
name: factory_bot
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
143
|
- - ">="
|
|
@@ -165,21 +165,21 @@ dependencies:
|
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: '0'
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
168
|
+
name: rspec-rails
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
|
-
- - "
|
|
171
|
+
- - ">="
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: 0
|
|
173
|
+
version: '0'
|
|
174
174
|
type: :development
|
|
175
175
|
prerelease: false
|
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
|
-
- - "
|
|
178
|
+
- - ">="
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: 0
|
|
180
|
+
version: '0'
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
|
-
name: rubocop
|
|
182
|
+
name: rubocop
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
185
|
- - ">="
|
|
@@ -193,7 +193,7 @@ dependencies:
|
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0'
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name:
|
|
196
|
+
name: rubocop-rspec
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
199
|
- - ">="
|
|
@@ -206,17 +206,10 @@ dependencies:
|
|
|
206
206
|
- - ">="
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '0'
|
|
209
|
-
description:
|
|
210
|
-
email:
|
|
209
|
+
description:
|
|
210
|
+
email:
|
|
211
211
|
executables:
|
|
212
|
-
- setup
|
|
213
|
-
- console
|
|
214
|
-
- rake
|
|
215
|
-
- spring
|
|
216
212
|
- travis_backup_for_v3
|
|
217
|
-
- rails
|
|
218
|
-
- bundle
|
|
219
|
-
- yarn
|
|
220
213
|
extensions: []
|
|
221
214
|
extra_rdoc_files: []
|
|
222
215
|
files:
|
|
@@ -339,12 +332,11 @@ files:
|
|
|
339
332
|
- tmp/.keep
|
|
340
333
|
- travis-backup-for-v3.gemspec
|
|
341
334
|
- vendor/.keep
|
|
342
|
-
|
|
343
|
-
homepage:
|
|
335
|
+
homepage:
|
|
344
336
|
licenses:
|
|
345
337
|
- Beerware
|
|
346
338
|
metadata: {}
|
|
347
|
-
post_install_message:
|
|
339
|
+
post_install_message:
|
|
348
340
|
rdoc_options: []
|
|
349
341
|
require_paths:
|
|
350
342
|
- lib
|
|
@@ -352,15 +344,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
352
344
|
requirements:
|
|
353
345
|
- - ">="
|
|
354
346
|
- !ruby/object:Gem::Version
|
|
355
|
-
version: 2.
|
|
347
|
+
version: 3.2.0
|
|
356
348
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
357
349
|
requirements:
|
|
358
350
|
- - ">="
|
|
359
351
|
- !ruby/object:Gem::Version
|
|
360
352
|
version: '0'
|
|
361
353
|
requirements: []
|
|
362
|
-
rubygems_version: 3.
|
|
363
|
-
signing_key:
|
|
354
|
+
rubygems_version: 3.5.16
|
|
355
|
+
signing_key:
|
|
364
356
|
specification_version: 4
|
|
365
357
|
summary: Travis CI backup tool
|
|
366
358
|
test_files: []
|