ridgepole 0.7.1.beta → 0.7.1.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/lib/ridgepole/cli/config.rb +1 -1
- data/lib/ridgepole/dumper.rb +8 -0
- data/lib/ridgepole/version.rb +1 -1
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +26 -0
- data/spec/mysql/ridgepole_test_tables_unknown_column_type.sql +17 -0
- data/spec/spec_helper.rb +5 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 130a2d52ac418b8bfd080f5696072f1e6abd00b2
|
4
|
+
data.tar.gz: 33ec9d8a72263cf6b7bcdcdc601e272d5dec616a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5a60a3d8a64cd0110049c1ac599bbf326f61c968d3884a810229c294b9263ef8a02943c121b4d2bb71b4820759bbc4a4113900580b7b773cb53b1fdb21f8815
|
7
|
+
data.tar.gz: 940bfaf02ac5a69c60c5081b522c6e02a7dc782826475ae64aba8977903adba4da4c1a556ba424f9cb2403c3e1d583f5269911886335fefd93a6aac808628a76
|
data/.travis.yml
CHANGED
@@ -15,9 +15,9 @@ before_script:
|
|
15
15
|
- sudo service mysql stop
|
16
16
|
- sudo service postgresql stop
|
17
17
|
- docker-compose up -d
|
18
|
-
- function mysql_ping { mysqladmin -u root -h 127.0.0.1 -ppassword ping
|
19
|
-
- function mysql57_ping { mysqladmin -u root -h 127.0.0.1 -P
|
20
|
-
- function pg_ping { PGPASSWORD=password pg_isready -U postgres -h 127.0.0.1
|
18
|
+
- function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P 13316 -ppassword ping; }
|
19
|
+
- function mysql57_ping { mysqladmin -u root -h 127.0.0.1 -P 13317 -ppassword ping; }
|
20
|
+
- function pg_ping { PGPASSWORD=password pg_isready -U postgres -h 127.0.0.1 -p 15442; }
|
21
21
|
- for i in {1..60}; do mysql_ping && break; sleep 1; done
|
22
22
|
- for i in {1..60}; do mysql57_ping && break; sleep 1; done
|
23
23
|
- for i in {1..60}; do pg_ping && break; sleep 1; done
|
data/lib/ridgepole/cli/config.rb
CHANGED
@@ -37,7 +37,7 @@ class Ridgepole::Config
|
|
37
37
|
def parse_database_url(config)
|
38
38
|
uri = URI.parse(config)
|
39
39
|
|
40
|
-
if [uri.scheme, uri.user, uri.host, uri.path].any? {|i| i.nil? }
|
40
|
+
if [uri.scheme, uri.user, uri.host, uri.path].any? {|i| i.nil? or i.empty? }
|
41
41
|
raise "Invalid config: #{config.inspect}"
|
42
42
|
end
|
43
43
|
|
data/lib/ridgepole/dumper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Ridgepole::Dumper
|
2
2
|
def initialize(options = {})
|
3
3
|
@options = options
|
4
|
+
@logger = Ridgepole::Logger.instance
|
4
5
|
end
|
5
6
|
|
6
7
|
def dump
|
@@ -29,6 +30,13 @@ class Ridgepole::Dumper
|
|
29
30
|
ActiveRecord::SchemaDumper.ignore_tables.clear
|
30
31
|
end
|
31
32
|
|
33
|
+
stream.string.lines.each_cons(2) do |first_line, second_line|
|
34
|
+
if first_line =~ /\A# Could not dump/
|
35
|
+
@logger.warn("[WARNING] #{first_line.sub(/\A# /, '').chomp}")
|
36
|
+
@logger.warn(second_line.sub(/\A#/, '').chomp)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
dsl = stream.string.lines.select do |line|
|
33
41
|
line !~ /\A#/ &&
|
34
42
|
line !~ /\AActiveRecord::Schema\.define/ &&
|
data/lib/ridgepole/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
describe 'Ridgepole::Client#dump' do
|
2
|
+
context 'when there is a tables' do
|
3
|
+
before { restore_tables_mysql_unknown_column_type }
|
4
|
+
subject { client }
|
5
|
+
|
6
|
+
it {
|
7
|
+
expect(subject.dump).to match_fuzzy erbh(<<-EOS)
|
8
|
+
create_table "clubs", <%= i cond(5.1, id: :integer) %>, unsigned: true, force: :cascade do |t|
|
9
|
+
t.string "name", default: "", null: false
|
10
|
+
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
11
|
+
end
|
12
|
+
EOS
|
13
|
+
}
|
14
|
+
|
15
|
+
it {
|
16
|
+
expect(Ridgepole::Logger.instance).to receive(:warn).twice
|
17
|
+
subject.dump
|
18
|
+
}
|
19
|
+
|
20
|
+
it {
|
21
|
+
expect(Ridgepole::Logger.instance).to receive(:warn).with("[WARNING] Could not dump table \"places\" because of following StandardError")
|
22
|
+
expect(Ridgepole::Logger.instance).to receive(:warn).with(" Unknown type 'geometry' for column 'location'")
|
23
|
+
subject.dump
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
USE `ridgepole_test`;
|
2
|
+
|
3
|
+
DROP TABLE IF EXISTS `clubs`;
|
4
|
+
CREATE TABLE `clubs` (
|
5
|
+
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
6
|
+
`name` varchar(255) NOT NULL DEFAULT '',
|
7
|
+
PRIMARY KEY (`id`),
|
8
|
+
UNIQUE KEY `idx_name` (`name`)
|
9
|
+
);
|
10
|
+
|
11
|
+
DROP TABLE IF EXISTS `places`;
|
12
|
+
CREATE TABLE `places` (
|
13
|
+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
14
|
+
`location` geometry NOT NULL,
|
15
|
+
PRIMARY KEY (`id`),
|
16
|
+
KEY `id` (`id`)
|
17
|
+
);
|
data/spec/spec_helper.rb
CHANGED
@@ -95,6 +95,11 @@ module SpecHelper
|
|
95
95
|
system_raise_on_fail("#{PG_PSQL} ridgepole_test -q -f #{sql_file} 2>/dev/null")
|
96
96
|
end
|
97
97
|
|
98
|
+
def restore_tables_mysql_unknown_column_type
|
99
|
+
sql_file = File.expand_path('../mysql/ridgepole_test_tables_unknown_column_type.sql', __FILE__)
|
100
|
+
system_raise_on_fail("#{MYSQL_CLI} < #{sql_file}")
|
101
|
+
end
|
102
|
+
|
98
103
|
def client(options = {}, config = {})
|
99
104
|
config = conn_spec(config)
|
100
105
|
default_options = {debug: condition(:debug)}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.1.
|
4
|
+
version: 0.7.1.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -258,6 +258,7 @@ files:
|
|
258
258
|
- spec/mysql/dump/dump_class_method_spec.rb
|
259
259
|
- spec/mysql/dump/dump_some_tables_spec.rb
|
260
260
|
- spec/mysql/dump/dump_spec.rb
|
261
|
+
- spec/mysql/dump/dump_unknown_column_type_spec.rb
|
261
262
|
- spec/mysql/dump/dump_without_table_options_spec.rb
|
262
263
|
- spec/mysql/fk/migrate_change_fk_spec.rb
|
263
264
|
- spec/mysql/fk/migrate_create_fk_spec.rb
|
@@ -323,6 +324,7 @@ files:
|
|
323
324
|
- spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb
|
324
325
|
- spec/mysql/ridgepole_test_database.sql
|
325
326
|
- spec/mysql/ridgepole_test_tables.sql
|
327
|
+
- spec/mysql/ridgepole_test_tables_unknown_column_type.sql
|
326
328
|
- spec/mysql/text_blob_types/text_blob_types_spec.rb
|
327
329
|
- spec/mysql/~default_name_fk/migrate_change_fk_spec.rb
|
328
330
|
- spec/mysql/~default_name_fk/migrate_create_fk_spec.rb
|
@@ -406,6 +408,7 @@ test_files:
|
|
406
408
|
- spec/mysql/dump/dump_class_method_spec.rb
|
407
409
|
- spec/mysql/dump/dump_some_tables_spec.rb
|
408
410
|
- spec/mysql/dump/dump_spec.rb
|
411
|
+
- spec/mysql/dump/dump_unknown_column_type_spec.rb
|
409
412
|
- spec/mysql/dump/dump_without_table_options_spec.rb
|
410
413
|
- spec/mysql/fk/migrate_change_fk_spec.rb
|
411
414
|
- spec/mysql/fk/migrate_create_fk_spec.rb
|
@@ -471,6 +474,7 @@ test_files:
|
|
471
474
|
- spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb
|
472
475
|
- spec/mysql/ridgepole_test_database.sql
|
473
476
|
- spec/mysql/ridgepole_test_tables.sql
|
477
|
+
- spec/mysql/ridgepole_test_tables_unknown_column_type.sql
|
474
478
|
- spec/mysql/text_blob_types/text_blob_types_spec.rb
|
475
479
|
- spec/mysql/~default_name_fk/migrate_change_fk_spec.rb
|
476
480
|
- spec/mysql/~default_name_fk/migrate_create_fk_spec.rb
|