db_mirror 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.github/workflows/ruby.yml +21 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +182 -0
- data/LICENSE +20 -0
- data/README.md +39 -0
- data/Rakefile +39 -0
- data/VERSION +1 -0
- data/bin/format +1 -0
- data/bin/lint +1 -0
- data/bin/setup +1 -0
- data/lib/cli/app/configuration.rb +35 -0
- data/lib/cli/version.rb +7 -0
- data/lib/db_mirror.rb +35 -0
- data/spec/helpers.rb +92 -0
- data/spec/spec_helper.rb +32 -0
- metadata +253 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d903f54b7a67de4dfd9df453f5e5a0aa3c04cfb08f77b9c53679084f812775b2
|
4
|
+
data.tar.gz: 9e05758fc92ffd1090b6a002c5e3290a581b6a068f5ace5cf7d47d263844f926
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 93eac660d29e9a3f07ec0fbf0a682bad5e792c899c22f8d2c69448794a223b8fcd8c8bf3f24bfbee9ae8cb8a125fac79156264e576f279bb16d8c33f1250f9fd
|
7
|
+
data.tar.gz: f8a1ca231a2658f6197b55a1f7c2c26d17b87c846fe928efe033c8f9cabbf81a6a6f5d7f7a845067fe3b5aeb1e368f8be2ae251bb3677ad7c351eb12dc620629
|
data/.document
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Ruby
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ master ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ master ]
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Run tests
|
21
|
+
run: bundle exec rspec
|
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "activerecord", ">= 4"
|
4
|
+
gem "activesupport", ">= 4"
|
5
|
+
gem "commander"
|
6
|
+
gem "gems"
|
7
|
+
gem "factory_bot"
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem "shoulda", ">= 0"
|
11
|
+
gem "bundler", "~> 2.0"
|
12
|
+
gem "juwelier", "~> 2.4", ">= 2.4.9"
|
13
|
+
gem "simplecov"
|
14
|
+
end
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem "standard"
|
18
|
+
gem "rspec"
|
19
|
+
gem "byebug", "~> 11.0"
|
20
|
+
gem "rspec-pride"
|
21
|
+
end
|
22
|
+
|
23
|
+
group :test do
|
24
|
+
gem "database_cleaner", "~> 1.0"
|
25
|
+
gem "sqlite3", "~> 1.0"
|
26
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (6.1.4.1)
|
5
|
+
activesupport (= 6.1.4.1)
|
6
|
+
activerecord (6.1.4.1)
|
7
|
+
activemodel (= 6.1.4.1)
|
8
|
+
activesupport (= 6.1.4.1)
|
9
|
+
activesupport (6.1.4.1)
|
10
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
|
+
i18n (>= 1.6, < 2)
|
12
|
+
minitest (>= 5.1)
|
13
|
+
tzinfo (~> 2.0)
|
14
|
+
zeitwerk (~> 2.3)
|
15
|
+
addressable (2.8.0)
|
16
|
+
public_suffix (>= 2.0.2, < 5.0)
|
17
|
+
ast (2.4.2)
|
18
|
+
builder (3.2.4)
|
19
|
+
byebug (11.1.3)
|
20
|
+
commander (4.6.0)
|
21
|
+
highline (~> 2.0.0)
|
22
|
+
concurrent-ruby (1.1.9)
|
23
|
+
database_cleaner (1.99.0)
|
24
|
+
descendants_tracker (0.0.4)
|
25
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
26
|
+
diff-lcs (1.4.4)
|
27
|
+
docile (1.4.0)
|
28
|
+
factory_bot (6.2.0)
|
29
|
+
activesupport (>= 5.0.0)
|
30
|
+
faraday (1.8.0)
|
31
|
+
faraday-em_http (~> 1.0)
|
32
|
+
faraday-em_synchrony (~> 1.0)
|
33
|
+
faraday-excon (~> 1.1)
|
34
|
+
faraday-httpclient (~> 1.0.1)
|
35
|
+
faraday-net_http (~> 1.0)
|
36
|
+
faraday-net_http_persistent (~> 1.1)
|
37
|
+
faraday-patron (~> 1.0)
|
38
|
+
faraday-rack (~> 1.0)
|
39
|
+
multipart-post (>= 1.2, < 3)
|
40
|
+
ruby2_keywords (>= 0.0.4)
|
41
|
+
faraday-em_http (1.0.0)
|
42
|
+
faraday-em_synchrony (1.0.0)
|
43
|
+
faraday-excon (1.1.0)
|
44
|
+
faraday-httpclient (1.0.1)
|
45
|
+
faraday-net_http (1.0.1)
|
46
|
+
faraday-net_http_persistent (1.2.0)
|
47
|
+
faraday-patron (1.0.0)
|
48
|
+
faraday-rack (1.0.0)
|
49
|
+
gems (1.2.0)
|
50
|
+
git (1.9.1)
|
51
|
+
rchardet (~> 1.8)
|
52
|
+
github_api (0.19.0)
|
53
|
+
addressable (~> 2.4)
|
54
|
+
descendants_tracker (~> 0.0.4)
|
55
|
+
faraday (>= 0.8, < 2)
|
56
|
+
hashie (~> 3.5, >= 3.5.2)
|
57
|
+
oauth2 (~> 1.0)
|
58
|
+
hashie (3.6.0)
|
59
|
+
highline (2.0.3)
|
60
|
+
i18n (1.8.10)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
juwelier (2.4.9)
|
63
|
+
builder
|
64
|
+
bundler
|
65
|
+
git
|
66
|
+
github_api
|
67
|
+
highline
|
68
|
+
kamelcase (~> 0)
|
69
|
+
nokogiri
|
70
|
+
psych
|
71
|
+
rake
|
72
|
+
rdoc
|
73
|
+
semver2
|
74
|
+
jwt (2.3.0)
|
75
|
+
kamelcase (0.0.2)
|
76
|
+
semver2 (~> 3)
|
77
|
+
mini_portile2 (2.6.1)
|
78
|
+
minitest (5.14.4)
|
79
|
+
multi_json (1.15.0)
|
80
|
+
multi_xml (0.6.0)
|
81
|
+
multipart-post (2.1.1)
|
82
|
+
nokogiri (1.12.5)
|
83
|
+
mini_portile2 (~> 2.6.1)
|
84
|
+
racc (~> 1.4)
|
85
|
+
nokogiri (1.12.5-x86_64-linux)
|
86
|
+
racc (~> 1.4)
|
87
|
+
oauth2 (1.4.7)
|
88
|
+
faraday (>= 0.8, < 2.0)
|
89
|
+
jwt (>= 1.0, < 3.0)
|
90
|
+
multi_json (~> 1.3)
|
91
|
+
multi_xml (~> 0.5)
|
92
|
+
rack (>= 1.2, < 3)
|
93
|
+
parallel (1.21.0)
|
94
|
+
parser (3.0.2.0)
|
95
|
+
ast (~> 2.4.1)
|
96
|
+
psych (4.0.1)
|
97
|
+
public_suffix (4.0.6)
|
98
|
+
racc (1.5.2)
|
99
|
+
rack (2.2.3)
|
100
|
+
rainbow (3.0.0)
|
101
|
+
rake (13.0.6)
|
102
|
+
rchardet (1.8.0)
|
103
|
+
rdoc (6.3.2)
|
104
|
+
regexp_parser (2.1.1)
|
105
|
+
rexml (3.2.5)
|
106
|
+
rspec (3.10.0)
|
107
|
+
rspec-core (~> 3.10.0)
|
108
|
+
rspec-expectations (~> 3.10.0)
|
109
|
+
rspec-mocks (~> 3.10.0)
|
110
|
+
rspec-core (3.10.1)
|
111
|
+
rspec-support (~> 3.10.0)
|
112
|
+
rspec-expectations (3.10.1)
|
113
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
114
|
+
rspec-support (~> 3.10.0)
|
115
|
+
rspec-mocks (3.10.2)
|
116
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
117
|
+
rspec-support (~> 3.10.0)
|
118
|
+
rspec-pride (3.2.1)
|
119
|
+
rspec (~> 3.0)
|
120
|
+
rspec-support (3.10.2)
|
121
|
+
rubocop (1.20.0)
|
122
|
+
parallel (~> 1.10)
|
123
|
+
parser (>= 3.0.0.0)
|
124
|
+
rainbow (>= 2.2.2, < 4.0)
|
125
|
+
regexp_parser (>= 1.8, < 3.0)
|
126
|
+
rexml
|
127
|
+
rubocop-ast (>= 1.9.1, < 2.0)
|
128
|
+
ruby-progressbar (~> 1.7)
|
129
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
130
|
+
rubocop-ast (1.12.0)
|
131
|
+
parser (>= 3.0.1.1)
|
132
|
+
rubocop-performance (1.11.5)
|
133
|
+
rubocop (>= 1.7.0, < 2.0)
|
134
|
+
rubocop-ast (>= 0.4.0)
|
135
|
+
ruby-progressbar (1.11.0)
|
136
|
+
ruby2_keywords (0.0.5)
|
137
|
+
semver2 (3.4.2)
|
138
|
+
shoulda (4.0.0)
|
139
|
+
shoulda-context (~> 2.0)
|
140
|
+
shoulda-matchers (~> 4.0)
|
141
|
+
shoulda-context (2.0.0)
|
142
|
+
shoulda-matchers (4.5.1)
|
143
|
+
activesupport (>= 4.2.0)
|
144
|
+
simplecov (0.21.2)
|
145
|
+
docile (~> 1.1)
|
146
|
+
simplecov-html (~> 0.11)
|
147
|
+
simplecov_json_formatter (~> 0.1)
|
148
|
+
simplecov-html (0.12.3)
|
149
|
+
simplecov_json_formatter (0.1.3)
|
150
|
+
sqlite3 (1.4.2)
|
151
|
+
standard (1.3.0)
|
152
|
+
rubocop (= 1.20.0)
|
153
|
+
rubocop-performance (= 1.11.5)
|
154
|
+
thread_safe (0.3.6)
|
155
|
+
tzinfo (2.0.4)
|
156
|
+
concurrent-ruby (~> 1.0)
|
157
|
+
unicode-display_width (2.1.0)
|
158
|
+
zeitwerk (2.4.2)
|
159
|
+
|
160
|
+
PLATFORMS
|
161
|
+
ruby
|
162
|
+
x86_64-linux
|
163
|
+
|
164
|
+
DEPENDENCIES
|
165
|
+
activerecord (>= 4)
|
166
|
+
activesupport (>= 4)
|
167
|
+
bundler (~> 2.0)
|
168
|
+
byebug (~> 11.0)
|
169
|
+
commander
|
170
|
+
database_cleaner (~> 1.0)
|
171
|
+
factory_bot
|
172
|
+
gems
|
173
|
+
juwelier (~> 2.4, >= 2.4.9)
|
174
|
+
rspec
|
175
|
+
rspec-pride
|
176
|
+
shoulda
|
177
|
+
simplecov
|
178
|
+
sqlite3 (~> 1.0)
|
179
|
+
standard
|
180
|
+
|
181
|
+
BUNDLED WITH
|
182
|
+
2.2.27
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2021 Liberatys
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# db_mirror
|
2
|
+
|
3
|
+
Peter: Hey Jeff! I'm done with the migration of the database..
|
4
|
+
Jeff: Really? Because the customer has sent us an email that only half of the data is migrated?
|
5
|
+
Peter: 😱... That is not possible!!
|
6
|
+
Jeff: Have you checked how many entries were in the original database?
|
7
|
+
Peter: Yea! There were 2'131'005 entries
|
8
|
+
Jeff: How many are in the new database?
|
9
|
+
Peter: .............900'231....
|
10
|
+
Jeff: 😠
|
11
|
+
|
12
|
+
Ensure that you rails database is migrated properly! Easy enough using db_mirror.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
gem install db_mirror
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
db_mirror LEVEL={level} EXCLUDED_MODELS={excluded_models}
|
21
|
+
|
22
|
+
|
23
|
+
## Comparison levels
|
24
|
+
|
25
|
+
### Level 1
|
26
|
+
|
27
|
+
### Level 2
|
28
|
+
|
29
|
+
### Level 3
|
30
|
+
|
31
|
+
### Level 4
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
[LICENSE](./LICENSE)
|
36
|
+
|
37
|
+
## Changelog
|
38
|
+
|
39
|
+
[Changelog](./CHANGELOG.md)
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
warn e.message
|
7
|
+
warn "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require "rake"
|
11
|
+
|
12
|
+
require "juwelier"
|
13
|
+
Juwelier::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
15
|
+
gem.name = "db_mirror"
|
16
|
+
gem.homepage = "http://github.com/Liberatys/db_mirror"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = "A ruby gem for validating your data migrations"
|
19
|
+
gem.description = "A ruby gem for validating your data migrations"
|
20
|
+
gem.email = "nick.flueckiger@renuo.ch"
|
21
|
+
gem.authors = ["Liberatys"]
|
22
|
+
# dependencies defined in Gemfile
|
23
|
+
end
|
24
|
+
Juwelier::RubygemsDotOrgTasks.new
|
25
|
+
|
26
|
+
require "rake/testtask"
|
27
|
+
Rake::TestTask.new(:test) do |test|
|
28
|
+
test.libs << "lib" << "rspec"
|
29
|
+
test.pattern = "spec/**/*_spec.rb"
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Code coverage detail"
|
34
|
+
task :simplecov do
|
35
|
+
ENV["COVERAGE"] = "true"
|
36
|
+
Rake::Task["test"].execute
|
37
|
+
end
|
38
|
+
|
39
|
+
task default: :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/format
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bundle exec standardrb --fix
|
data/bin/lint
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bundle exec standardrb
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bundle install
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Configuration
|
2
|
+
attr_accessor :excluded_models, :output_path, :comparison_level
|
3
|
+
|
4
|
+
DEFAULT_COMPARISON_LEVEL = 1
|
5
|
+
|
6
|
+
COMPARISON_LEVELS = {
|
7
|
+
1 => :quick,
|
8
|
+
2 => :novice,
|
9
|
+
3 => :extensive,
|
10
|
+
4 => :full
|
11
|
+
}
|
12
|
+
|
13
|
+
def initialize(excluded_models: [], output_path: "db_mirrored", comparison_level: DEFAULT_COMPARISON_LEVEL)
|
14
|
+
self.excluded_models = excluded_models
|
15
|
+
self.output_path = output_path
|
16
|
+
self.comparison_level = COMPARISON_LEVELS[comparison_level] || DEFAULT_COMPARISON_LEVEL
|
17
|
+
end
|
18
|
+
|
19
|
+
def valid_attributes!
|
20
|
+
if !excluded_models.is_a?(Array)
|
21
|
+
raise("Invalid excluded_models value! Was expecting an array")
|
22
|
+
end
|
23
|
+
|
24
|
+
if !output_path.present?
|
25
|
+
raise("Invalid output_path value! Expected non empty string")
|
26
|
+
end
|
27
|
+
|
28
|
+
if COMPARISON_LEVELS.invert[comparison_level].nil?
|
29
|
+
raise("Invalid comparison_level value! Expected a value between 1-4")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def from_hash(hash_object)
|
34
|
+
end
|
35
|
+
end
|
data/lib/cli/version.rb
ADDED
data/lib/db_mirror.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "commander"
|
3
|
+
require "gems"
|
4
|
+
|
5
|
+
module DbMirror
|
6
|
+
class CLI
|
7
|
+
include Commander::Methods
|
8
|
+
|
9
|
+
def start
|
10
|
+
program :name, DbMirror::Cli::NAME
|
11
|
+
program :version, DbMirror::Cli::VERSION
|
12
|
+
program :description, DbMirror::Cli::DESCRIPTION
|
13
|
+
update_gem!
|
14
|
+
|
15
|
+
command :gen do |c|
|
16
|
+
end
|
17
|
+
|
18
|
+
command :compare do |c|
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_gem!
|
23
|
+
info = Gems.info DbMirror::Cli::NAME
|
24
|
+
|
25
|
+
if Gem::Version.new(DbMirror::Cli::VERSION) < Gem::Version.new(info["version"])
|
26
|
+
say "You are running the version #{DbMirror::Cli::VERSION} but the brand new #{info["version"]} is available. 🎉"
|
27
|
+
if agree("Why don't you update with `gem update #{DbMirror::Cli::VERSION}`? I can run it for you. 💪")
|
28
|
+
system("gem update #{DbMirror::Cli::NAME}")
|
29
|
+
abort "Nice! I updated myself. Now you can run the command again."
|
30
|
+
end
|
31
|
+
abort("Good. Just do it yourself then...😒")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/helpers.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Mock Rails.application.eager_load! and define some
|
2
|
+
# Rails models for use in specs.
|
3
|
+
class Rails
|
4
|
+
def self.application
|
5
|
+
self
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.eager_load!
|
9
|
+
@already_called ||= false
|
10
|
+
|
11
|
+
unless @already_called
|
12
|
+
Object.const_set("Sample", Class.new(ActiveRecord::Base))
|
13
|
+
|
14
|
+
Object.const_set("AnotherSample", Class.new(ActiveRecord::Base))
|
15
|
+
|
16
|
+
Object.const_set("YetAnotherSample", Class.new(ActiveRecord::Base))
|
17
|
+
|
18
|
+
Object.const_set("NoTableModel", Class.new(ActiveRecord::Base))
|
19
|
+
|
20
|
+
Object.const_set("EmptyModel", Class.new(ActiveRecord::Base))
|
21
|
+
|
22
|
+
@already_called = true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.env
|
27
|
+
"test"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Helpers
|
32
|
+
def create_db
|
33
|
+
ActiveRecord::Migration.verbose = false
|
34
|
+
|
35
|
+
ActiveRecord::Schema.define(version: 1) do
|
36
|
+
create_table "samples", force: true do |t|
|
37
|
+
t.string "string"
|
38
|
+
t.text "text"
|
39
|
+
t.integer "integer"
|
40
|
+
t.float "float"
|
41
|
+
t.decimal "decimal"
|
42
|
+
t.datetime "datetime"
|
43
|
+
t.time "time"
|
44
|
+
t.date "date"
|
45
|
+
t.binary "binary"
|
46
|
+
t.boolean "boolean"
|
47
|
+
t.datetime "created_at", null: false
|
48
|
+
t.datetime "updated_at", null: false
|
49
|
+
end
|
50
|
+
|
51
|
+
create_table "another_samples", force: true do |t|
|
52
|
+
t.string "string"
|
53
|
+
t.text "text"
|
54
|
+
t.integer "integer"
|
55
|
+
t.float "float"
|
56
|
+
t.decimal "decimal"
|
57
|
+
t.datetime "datetime"
|
58
|
+
t.time "time"
|
59
|
+
t.date "date"
|
60
|
+
t.binary "binary"
|
61
|
+
t.boolean "boolean"
|
62
|
+
t.datetime "created_at", null: false
|
63
|
+
t.datetime "updated_at", null: false
|
64
|
+
end
|
65
|
+
|
66
|
+
create_table "yet_another_samples", force: true do |t|
|
67
|
+
t.string "string"
|
68
|
+
t.text "text"
|
69
|
+
t.integer "integer"
|
70
|
+
t.float "float"
|
71
|
+
t.decimal "decimal"
|
72
|
+
t.datetime "datetime"
|
73
|
+
t.time "time"
|
74
|
+
t.date "date"
|
75
|
+
t.binary "binary"
|
76
|
+
t.boolean "boolean"
|
77
|
+
t.datetime "created_at", null: false
|
78
|
+
t.datetime "updated_at", null: false
|
79
|
+
end
|
80
|
+
|
81
|
+
create_table "empty_models", force: true
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def load_sample_data
|
86
|
+
Rails.application.eager_load!
|
87
|
+
|
88
|
+
Sample.create!
|
89
|
+
|
90
|
+
ChildSample.create!
|
91
|
+
end
|
92
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "db_mirror"
|
2
|
+
|
3
|
+
require "active_support"
|
4
|
+
require "active_record"
|
5
|
+
require "byebug"
|
6
|
+
require "database_cleaner"
|
7
|
+
require "factory_bot"
|
8
|
+
|
9
|
+
require "./spec/helpers"
|
10
|
+
|
11
|
+
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
|
12
|
+
|
13
|
+
FactoryBot.find_definitions
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.order = "random"
|
17
|
+
|
18
|
+
config.include Helpers
|
19
|
+
|
20
|
+
config.before(:suite) do
|
21
|
+
DatabaseCleaner.strategy = :transaction
|
22
|
+
DatabaseCleaner.clean_with(:truncation)
|
23
|
+
end
|
24
|
+
|
25
|
+
config.before do
|
26
|
+
DatabaseCleaner.start
|
27
|
+
end
|
28
|
+
|
29
|
+
config.after do
|
30
|
+
DatabaseCleaner.clean
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: db_mirror
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Liberatys
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: commander
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
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: gems
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
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: factory_bot
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
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: shoulda
|
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: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: juwelier
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.4'
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 2.4.9
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - "~>"
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '2.4'
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 2.4.9
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: simplecov
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: standard
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: rspec
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: byebug
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '11.0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - "~>"
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '11.0'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: rspec-pride
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
description: A ruby gem for validating your data migrations
|
202
|
+
email: nick.flueckiger@renuo.ch
|
203
|
+
executables:
|
204
|
+
- format
|
205
|
+
- lint
|
206
|
+
- setup
|
207
|
+
extensions: []
|
208
|
+
extra_rdoc_files:
|
209
|
+
- LICENSE
|
210
|
+
- README.md
|
211
|
+
files:
|
212
|
+
- ".document"
|
213
|
+
- ".github/workflows/ruby.yml"
|
214
|
+
- ".rspec"
|
215
|
+
- CHANGELOG.md
|
216
|
+
- Gemfile
|
217
|
+
- Gemfile.lock
|
218
|
+
- LICENSE
|
219
|
+
- README.md
|
220
|
+
- Rakefile
|
221
|
+
- VERSION
|
222
|
+
- bin/format
|
223
|
+
- bin/lint
|
224
|
+
- bin/setup
|
225
|
+
- lib/cli/app/configuration.rb
|
226
|
+
- lib/cli/version.rb
|
227
|
+
- lib/db_mirror.rb
|
228
|
+
- spec/helpers.rb
|
229
|
+
- spec/spec_helper.rb
|
230
|
+
homepage: http://github.com/Liberatys/db_mirror
|
231
|
+
licenses:
|
232
|
+
- MIT
|
233
|
+
metadata: {}
|
234
|
+
post_install_message:
|
235
|
+
rdoc_options: []
|
236
|
+
require_paths:
|
237
|
+
- lib
|
238
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
|
+
requirements:
|
245
|
+
- - ">="
|
246
|
+
- !ruby/object:Gem::Version
|
247
|
+
version: '0'
|
248
|
+
requirements: []
|
249
|
+
rubygems_version: 3.1.2
|
250
|
+
signing_key:
|
251
|
+
specification_version: 4
|
252
|
+
summary: A ruby gem for validating your data migrations
|
253
|
+
test_files: []
|