departure 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +16 -0
- data/CHANGELOG.md +95 -0
- data/CODE_OF_CONDUCT.md +50 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +147 -0
- data/Rakefile +17 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/config.yml +3 -0
- data/configuration.rb +15 -0
- data/departure.gemspec +35 -0
- data/lib/active_record/connection_adapters/percona_adapter.rb +121 -0
- data/lib/departure.rb +65 -0
- data/lib/departure/alter_argument.rb +43 -0
- data/lib/departure/cli_generator.rb +134 -0
- data/lib/departure/configuration.rb +18 -0
- data/lib/departure/errors.rb +35 -0
- data/lib/departure/logger.rb +31 -0
- data/lib/departure/logger_factory.rb +17 -0
- data/lib/departure/null_logger.rb +15 -0
- data/lib/departure/railtie.rb +28 -0
- data/lib/departure/runner.rb +136 -0
- data/lib/departure/version.rb +3 -0
- data/lib/lhm.rb +25 -0
- data/lib/lhm/adapter.rb +109 -0
- data/lib/lhm/column_with_sql.rb +90 -0
- data/lib/lhm/column_with_type.rb +31 -0
- data/test_database.rb +52 -0
- metadata +195 -0
data/test_database.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Setups the test database with the schema_migrations table that ActiveRecord
|
2
|
+
# requires for the migrations, plus a table for the Comment model used throught
|
3
|
+
# the tests.
|
4
|
+
#
|
5
|
+
class TestDatabase
|
6
|
+
|
7
|
+
# Constructor
|
8
|
+
#
|
9
|
+
# @param config [Hash]
|
10
|
+
def initialize(config)
|
11
|
+
@config = config
|
12
|
+
@database = config['database']
|
13
|
+
end
|
14
|
+
|
15
|
+
# Creates the test database, the schema_migrations and the comments tables.
|
16
|
+
# It drops any of them if they already exist
|
17
|
+
def setup
|
18
|
+
setup_test_database
|
19
|
+
drop_and_create_schema_migrations_table
|
20
|
+
end
|
21
|
+
|
22
|
+
# Creates the test database and the comments table in it.
|
23
|
+
# Before, it drops both if they already exist
|
24
|
+
def setup_test_database
|
25
|
+
drop_and_create_test_database
|
26
|
+
drop_and_create_comments_table
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates the ActiveRecord's schema_migrations table required for
|
30
|
+
# migrations to work. Before, it drops the table if it already exists
|
31
|
+
def drop_and_create_schema_migrations_table
|
32
|
+
%x(#{mysql_command} "USE #{database}; DROP TABLE IF EXISTS schema_migrations; CREATE TABLE schema_migrations ( version varchar(255) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY unique_schema_migrations (version)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci")
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :config, :database
|
38
|
+
|
39
|
+
def drop_and_create_test_database
|
40
|
+
%x(#{mysql_command} "DROP DATABASE IF EXISTS #{database}; CREATE DATABASE #{database} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci;")
|
41
|
+
end
|
42
|
+
|
43
|
+
def drop_and_create_comments_table
|
44
|
+
%x(#{mysql_command} "USE #{database}; DROP TABLE IF EXISTS comments; CREATE TABLE comments ( id int(12) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;")
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns the command to run the mysql client. It uses the crendentials from
|
48
|
+
# the provided config
|
49
|
+
def mysql_command
|
50
|
+
"mysql --user=#{config['username']} --password=#{config['password']} -e"
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: departure
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ilya Zayats
|
8
|
+
- Pau Pérez
|
9
|
+
- Fran Casas
|
10
|
+
- Jorge Morante
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rails
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.2.22
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.22
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: mysql2
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.3.20
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.3.20
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: bundler
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.10'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '1.10'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '10.0'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '10.0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: rspec
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '3.4'
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 3.4.0
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.4'
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 3.4.0
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: rspec-its
|
94
|
+
requirement: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '1.2'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.2'
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: byebug
|
108
|
+
requirement: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '8.2'
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 8.2.1
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '8.2'
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 8.2.1
|
126
|
+
description: Execute your ActiveRecord migrations with Percona's pt-online-schema-change.
|
127
|
+
Formerly known as Percona Migrator.
|
128
|
+
email:
|
129
|
+
- ilya.zayats@redbooth.com
|
130
|
+
- pau.perez@redbooth.com
|
131
|
+
- fran.casas@redbooth.com
|
132
|
+
- jorge.morante@redbooth.com
|
133
|
+
executables: []
|
134
|
+
extensions: []
|
135
|
+
extra_rdoc_files: []
|
136
|
+
files:
|
137
|
+
- ".gitignore"
|
138
|
+
- ".rspec"
|
139
|
+
- ".travis.yml"
|
140
|
+
- CHANGELOG.md
|
141
|
+
- CODE_OF_CONDUCT.md
|
142
|
+
- Gemfile
|
143
|
+
- LICENSE.txt
|
144
|
+
- README.md
|
145
|
+
- Rakefile
|
146
|
+
- bin/console
|
147
|
+
- bin/setup
|
148
|
+
- config.yml
|
149
|
+
- configuration.rb
|
150
|
+
- departure.gemspec
|
151
|
+
- lib/active_record/connection_adapters/percona_adapter.rb
|
152
|
+
- lib/departure.rb
|
153
|
+
- lib/departure/alter_argument.rb
|
154
|
+
- lib/departure/cli_generator.rb
|
155
|
+
- lib/departure/configuration.rb
|
156
|
+
- lib/departure/errors.rb
|
157
|
+
- lib/departure/logger.rb
|
158
|
+
- lib/departure/logger_factory.rb
|
159
|
+
- lib/departure/null_logger.rb
|
160
|
+
- lib/departure/railtie.rb
|
161
|
+
- lib/departure/runner.rb
|
162
|
+
- lib/departure/version.rb
|
163
|
+
- lib/lhm.rb
|
164
|
+
- lib/lhm/adapter.rb
|
165
|
+
- lib/lhm/column_with_sql.rb
|
166
|
+
- lib/lhm/column_with_type.rb
|
167
|
+
- test_database.rb
|
168
|
+
homepage: http://github.com/redbooth/departure
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message: |2
|
173
|
+
! The Percona_migrator gem has been deprecated and has been replaced by Departure.
|
174
|
+
! See: https://rubygems.org/gems/departure
|
175
|
+
! And: https://github.com/redbooth/departure
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.6.10
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: pt-online-schema-change runner for ActiveRecord migrations
|
195
|
+
test_files: []
|