ridgepole 0.6.6 → 0.7.0.alpha
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/.travis.yml +2 -7
- data/Appraisals +4 -5
- data/README.md +3 -0
- data/gemfiles/activerecord_5.0.gemfile +1 -1
- data/gemfiles/{activerecord_4.2.gemfile → activerecord_5.1.gemfile} +1 -2
- data/lib/ridgepole.rb +1 -0
- data/lib/ridgepole/client.rb +1 -3
- data/lib/ridgepole/connection_adapters.rb +11 -0
- data/lib/ridgepole/delta.rb +5 -0
- data/lib/ridgepole/diff.rb +5 -10
- data/lib/ridgepole/dsl_parser/context.rb +1 -4
- data/lib/ridgepole/dumper.rb +0 -11
- data/lib/ridgepole/schema_statements_ext.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +2 -2
- data/ridgepole.iml +9 -0
- data/spec/erb_helper.rb +25 -15
- data/spec/mysql/bigint_pk/bigint_pk_spec.rb +15 -15
- data/spec/mysql/bigint_pk/int_pk_spec.rb +45 -0
- data/spec/mysql/cli/config_spec.rb +7 -7
- data/spec/mysql/cli/ridgepole_spec.rb +20 -20
- data/spec/mysql/collation/collation_spec.rb +40 -41
- data/spec/mysql/comment/comment_spec.rb +19 -19
- data/spec/mysql/default_lambda/default_lambda_spec.rb +3 -3
- data/spec/mysql/diff/diff2_spec.rb +8 -5
- data/spec/mysql/diff/diff_spec.rb +8 -5
- data/spec/mysql/dump/dump_class_method_spec.rb +18 -68
- data/spec/mysql/dump/dump_some_tables_spec.rb +10 -30
- data/spec/mysql/dump/dump_spec.rb +21 -54
- data/spec/mysql/dump/dump_without_table_options_spec.rb +8 -35
- data/spec/mysql/fk/migrate_change_fk_spec.rb +8 -8
- data/spec/mysql/fk/migrate_create_fk_spec.rb +21 -35
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +16 -30
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +3 -5
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +21 -39
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +23 -16
- data/spec/mysql/migrate/migrate_change_column_spec.rb +34 -34
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +19 -9
- data/spec/mysql/migrate/migrate_create_index_spec.rb +32 -32
- data/spec/mysql/migrate/migrate_create_table_spec.rb +0 -9
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +32 -32
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +30 -30
- data/spec/mysql/migrate/migrate_execute_spec.rb +68 -81
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +1 -3
- data/spec/mysql/migrate/migrate_noop_spec.rb +34 -61
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +3 -24
- data/spec/mysql/migrate/migrate_same_spec.rb +12 -45
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +1 -6
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +10 -10
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +3 -3
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +10 -10
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +6 -6
- data/spec/postgresql/diff/diff_spec.rb +6 -0
- data/spec/postgresql/dump/dump_spec.rb +9 -33
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +10 -26
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +0 -9
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +1 -1
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +7 -7
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +0 -3
- data/spec/postgresql/migrate/migrate_same_spec.rb +9 -33
- data/spec/spec_condition.rb +15 -6
- data/spec/spec_helper.rb +2 -15
- metadata +14 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c4e5ed48fbd6469287d34ef340f9a3693fc2470
|
4
|
+
data.tar.gz: e9cc11808cd560064217cf5441a875df892ca207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5e244204d6cad0ea31b7b330813f2086e49881e4773277748beaf5f36de9e2c7a927bad952acdaf87631a1f932aa97ca5c0eaeeafe16bd35b06c5e9604637c
|
7
|
+
data.tar.gz: 4e6abdd8a8fd60bf425cf2431c693f140ddcf7836fd1b5f2353f31aa57f870def2d4c6442e0e144839010a3b8b4bd4d0927428cbb74bf23f821a68939c0fbe4b
|
data/.travis.yml
CHANGED
@@ -21,17 +21,12 @@ before_script:
|
|
21
21
|
script:
|
22
22
|
- bundle exec rake
|
23
23
|
gemfile:
|
24
|
-
- gemfiles/activerecord_4.2.gemfile
|
25
24
|
- gemfiles/activerecord_5.0.gemfile
|
25
|
+
- gemfiles/activerecord_5.1.gemfile
|
26
26
|
env:
|
27
27
|
matrix:
|
28
|
-
-
|
29
|
-
- ENABLE_MYSQL_AWESOME=1
|
28
|
+
- POSTGRESQL=0
|
30
29
|
- POSTGRESQL=1
|
31
|
-
matrix:
|
32
|
-
exclude:
|
33
|
-
- env: ENABLE_MYSQL_AWESOME=1
|
34
|
-
gemfile: gemfiles/activerecord_5.0.gemfile
|
35
30
|
services:
|
36
31
|
- docker
|
37
32
|
addons:
|
data/Appraisals
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
appraise
|
2
|
-
gem 'activerecord', '~>
|
3
|
-
gem 'activerecord-mysql-awesome', '>= 0.0.7'
|
1
|
+
appraise 'activerecord-5.0' do
|
2
|
+
gem 'activerecord', '~> 5.0.1'
|
4
3
|
end
|
5
4
|
|
6
|
-
appraise 'activerecord-5.
|
7
|
-
gem 'activerecord', '~> 5.
|
5
|
+
appraise 'activerecord-5.1' do
|
6
|
+
gem 'activerecord', '~> 5.1.0'
|
8
7
|
end
|
data/README.md
CHANGED
@@ -73,6 +73,9 @@ add_foreign_key :articles, :authors # without `name:`
|
|
73
73
|
* Use `t.column` for migration ([pull#114](https://github.com/winebarrel/ridgepole/pull/114))
|
74
74
|
* Support DATABASE_URL format ([pull#118](https://github.com/winebarrel/ridgepole/pull/118))
|
75
75
|
* Add Ruby2.4 CI ([pull#119](https://github.com/winebarrel/ridgepole/pull/119))
|
76
|
+
* `>= 0.7.0`
|
77
|
+
* Remove Rails 4.x support
|
78
|
+
* Add Rails 5.1 support
|
76
79
|
|
77
80
|
## Installation
|
78
81
|
|
data/lib/ridgepole.rb
CHANGED
data/lib/ridgepole/client.rb
CHANGED
@@ -26,9 +26,7 @@ class Ridgepole::Client
|
|
26
26
|
require 'ridgepole/ext/schema_dumper'
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
require 'ridgepole/ext/abstract_mysql_adapter/disable_table_options'
|
31
|
-
end
|
29
|
+
require 'ridgepole/ext/abstract_mysql_adapter/disable_table_options'
|
32
30
|
end
|
33
31
|
|
34
32
|
def dump(&block)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Ridgepole
|
2
|
+
class ConnectionAdapters
|
3
|
+
def self.mysql?
|
4
|
+
defined?(ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.postgresql?
|
8
|
+
defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/ridgepole/delta.rb
CHANGED
@@ -345,6 +345,11 @@ rename_column(#{table_name.inspect}, #{from_column_name.inspect}, #{to_column_na
|
|
345
345
|
type = attrs.fetch(:type)
|
346
346
|
options = attrs[:options] || {}
|
347
347
|
|
348
|
+
# Fix for https://github.com/rails/rails/commit/7f0567b43b73b1bd1a16bfac9cd32fcbf1321b51
|
349
|
+
if Ridgepole::ConnectionAdapters.mysql? and ActiveRecord::VERSION::STRING !~ /\A5\.0\./
|
350
|
+
options[:comment] = nil unless options.has_key?(:comment)
|
351
|
+
end
|
352
|
+
|
348
353
|
if @options[:bulk_change]
|
349
354
|
buf.puts(<<-EOS)
|
350
355
|
t.change(#{column_name.inspect}, #{type.inspect}, #{inspect_options_include_default_proc(options)})
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -55,8 +55,6 @@ class Ridgepole::Diff
|
|
55
55
|
next unless target?(table_name)
|
56
56
|
|
57
57
|
if (from_table_name = (to_attrs[:options] || {}).delete(:renamed_from))
|
58
|
-
from_table_name = from_table_name.to_s if from_table_name
|
59
|
-
|
60
58
|
# Already renamed
|
61
59
|
next if from[table_name]
|
62
60
|
|
@@ -149,7 +147,7 @@ class Ridgepole::Diff
|
|
149
147
|
priv_column_name = column_name
|
150
148
|
end
|
151
149
|
|
152
|
-
if
|
150
|
+
if Ridgepole::ConnectionAdapters.postgresql?
|
153
151
|
added_size = 0
|
154
152
|
to.reverse_each.with_index do |(column_name, to_attrs), i|
|
155
153
|
if to_attrs[:options].delete(:after)
|
@@ -197,8 +195,6 @@ class Ridgepole::Diff
|
|
197
195
|
def scan_column_rename(from, to, definition_delta)
|
198
196
|
to.dup.each do |column_name, to_attrs|
|
199
197
|
if (from_column_name = (to_attrs[:options] || {}).delete(:renamed_from))
|
200
|
-
from_column_name = from_column_name.to_s if from_column_name
|
201
|
-
|
202
198
|
# Already renamed
|
203
199
|
next if from[column_name]
|
204
200
|
|
@@ -372,8 +368,10 @@ class Ridgepole::Diff
|
|
372
368
|
to_attrs[:options].delete(:null)
|
373
369
|
end
|
374
370
|
|
375
|
-
if
|
376
|
-
|
371
|
+
if Ridgepole::ConnectionAdapters.mysql? and ActiveRecord::VERSION::STRING =~ /\A5\.0\./
|
372
|
+
if to_attrs[:options][:default] == nil and to_attrs[:options][:null] == false
|
373
|
+
Ridgepole::Logger.instance.warn("[WARNING] Table `#{table_name}`: `default: nil` is ignored when `null: false`. Please apply twice")
|
374
|
+
end
|
377
375
|
end
|
378
376
|
|
379
377
|
to_attrs
|
@@ -403,7 +401,4 @@ class Ridgepole::Diff
|
|
403
401
|
diffy.to_s(:text).gsub(/\s+\z/m, '')
|
404
402
|
end
|
405
403
|
|
406
|
-
def self.postgresql?
|
407
|
-
defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
408
|
-
end
|
409
404
|
end
|
@@ -65,10 +65,7 @@ class Ridgepole::DSLParser
|
|
65
65
|
options[:length][col] = index_length
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
if ActiveRecord::VERSION::MAJOR >= 6 or (ActiveRecord::VERSION::MAJOR == 5 and (ActiveRecord::VERSION::MINOR >= 1 or ActiveRecord::VERSION::TINY >= 1))
|
70
|
-
options[:length] = options[:length].symbolize_keys
|
71
|
-
end
|
68
|
+
options[:length] = options[:length].symbolize_keys
|
72
69
|
end
|
73
70
|
|
74
71
|
@__definition[table_name][:indices][idx] = {
|
data/lib/ridgepole/dumper.rb
CHANGED
@@ -36,17 +36,6 @@ class Ridgepole::Dumper
|
|
36
36
|
line !~ /\Aend/
|
37
37
|
end
|
38
38
|
|
39
|
-
# XXX: for activerecord-mysql-awesome
|
40
|
-
if ActiveRecord::VERSION::MAJOR < 5
|
41
|
-
dsl = dsl.map do |line|
|
42
|
-
if @options[:dump_without_table_options] and line =~ /\A create_table /
|
43
|
-
line.gsub(/, options: ("(?:[^"]|\")*")/, '')
|
44
|
-
else
|
45
|
-
line
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
39
|
dsl = dsl.join.strip_heredoc
|
51
40
|
|
52
41
|
definitions = []
|
@@ -2,7 +2,7 @@ require 'active_record/connection_adapters/abstract/schema_statements'
|
|
2
2
|
|
3
3
|
module Ridgepole
|
4
4
|
module SchemaStatementsExt
|
5
|
-
def index_name_exists?(table_name, column_name,
|
5
|
+
def index_name_exists?(table_name, column_name, default = nil)
|
6
6
|
if Ridgepole::ExecuteExpander.noop
|
7
7
|
caller_methods = caller.map {|i| i =~ /:\d+:in `(.+)'/ ? $1 : '' }
|
8
8
|
if caller_methods.any? {|i| i =~ /\Aremove_index/ }
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'activerecord', '>=
|
21
|
+
spec.add_dependency 'activerecord', '>= 5.0.1', '< 6'
|
22
22
|
spec.add_dependency 'diffy'
|
23
23
|
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.1.3'
|
31
31
|
spec.add_development_dependency 'erbh', '>= 0.1.2'
|
32
32
|
spec.add_development_dependency 'hash_modern_inspect', '>= 0.1.1'
|
33
|
-
spec.add_development_dependency 'hash_order_helper', '>= 0.1.
|
33
|
+
spec.add_development_dependency 'hash_order_helper', '>= 0.1.6'
|
34
34
|
end
|
data/ridgepole.iml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="WEB_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
6
|
+
<orderEntry type="inheritedJdk" />
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
8
|
+
</component>
|
9
|
+
</module>
|
data/spec/erb_helper.rb
CHANGED
@@ -10,25 +10,29 @@ ERBh.define_method(:i) do |obj|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
ERBh.define_method(:add_index) do |table_name, column_name, options|
|
13
|
-
if
|
14
|
-
|
15
|
-
|
16
|
-
end
|
13
|
+
if options[:length].is_a?(Hash)
|
14
|
+
options[:length] = options[:length].symbolize_keys
|
15
|
+
end
|
17
16
|
|
18
|
-
|
17
|
+
@_erbout.sub!(/\bend\s*\z/, '')
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
EOS
|
24
|
-
else
|
25
|
-
"add_index #{table_name.inspect}, #{column_name.inspect}, #{options.modern_inspect_without_brace}"
|
19
|
+
# XXX:
|
20
|
+
if not condition('5.0') and options[:using] == :btree
|
21
|
+
options.delete(:using)
|
26
22
|
end
|
23
|
+
|
24
|
+
# XXX:
|
25
|
+
if options.has_key?(:force_using)
|
26
|
+
options[:using] = options.delete(:force_using)
|
27
|
+
end
|
28
|
+
|
29
|
+
<<-EOS
|
30
|
+
t.index #{column_name.inspect}, #{options.modern_inspect_without_brace}
|
31
|
+
end
|
32
|
+
EOS
|
27
33
|
end
|
28
34
|
|
29
35
|
ERBh.define_method(:unsigned) do |value, *conds|
|
30
|
-
conds = [:mysql_awesome_enabled] if conds.empty?
|
31
|
-
|
32
36
|
if condition(*conds)
|
33
37
|
{unsigned: value}
|
34
38
|
else
|
@@ -37,11 +41,17 @@ ERBh.define_method(:unsigned) do |value, *conds|
|
|
37
41
|
end
|
38
42
|
|
39
43
|
ERBh.define_method(:limit) do |value, *conds|
|
40
|
-
conds = [:activerecord_4] if conds.empty?
|
41
|
-
|
42
44
|
if condition(*conds)
|
43
45
|
{limit: value}
|
44
46
|
else
|
45
47
|
{}
|
46
48
|
end
|
47
49
|
end
|
50
|
+
|
51
|
+
ERBh.define_method(:cond) do |conds, m, e = nil|
|
52
|
+
if condition(*Array(conds))
|
53
|
+
m
|
54
|
+
else
|
55
|
+
e || (m.class.new rescue nil)
|
56
|
+
end
|
57
|
+
end
|
@@ -1,45 +1,45 @@
|
|
1
|
-
describe 'Ridgepole::Client (with bigint pk)', condition:
|
2
|
-
let(:
|
3
|
-
|
1
|
+
describe 'Ridgepole::Client (with bigint pk)', condition: '5.0.' do
|
2
|
+
let(:id_primary_key_create_table) {
|
3
|
+
<<-RUBY
|
4
4
|
create_table "books", id: :primary_key, limit: 8, force: :cascade do |t|
|
5
|
-
t.string "title",
|
6
|
-
t.integer "author_id",
|
5
|
+
t.string "title", null: false
|
6
|
+
t.integer "author_id", null: false
|
7
7
|
t.datetime "created_at"
|
8
8
|
t.datetime "updated_at"
|
9
9
|
end
|
10
|
-
|
10
|
+
RUBY
|
11
11
|
}
|
12
12
|
|
13
|
-
let(:
|
14
|
-
|
13
|
+
let(:id_bigint_create_table) {
|
14
|
+
<<-RUBY
|
15
15
|
create_table "books", id: :bigint, force: :cascade do |t|
|
16
|
-
t.string "title",
|
17
|
-
t.integer "author_id",
|
16
|
+
t.string "title", null: false
|
17
|
+
t.integer "author_id", null: false
|
18
18
|
t.datetime "created_at"
|
19
19
|
t.datetime "updated_at"
|
20
20
|
end
|
21
|
-
|
21
|
+
RUBY
|
22
22
|
}
|
23
23
|
|
24
24
|
context 'when with limit:8' do
|
25
25
|
subject { client }
|
26
26
|
|
27
|
-
before { subject.diff(
|
27
|
+
before { subject.diff(id_primary_key_create_table).migrate }
|
28
28
|
|
29
29
|
it {
|
30
30
|
expect(show_create_table(:books)).to include '`id` bigint(20) NOT NULL AUTO_INCREMENT'
|
31
|
-
expect(subject.dump).to match_fuzzy
|
31
|
+
expect(subject.dump).to match_fuzzy id_bigint_create_table
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when with id:bigint' do
|
36
36
|
subject { client }
|
37
37
|
|
38
|
-
before { subject.diff(
|
38
|
+
before { subject.diff(id_bigint_create_table).migrate }
|
39
39
|
|
40
40
|
it {
|
41
41
|
expect(show_create_table(:books)).to include '`id` bigint(20) NOT NULL AUTO_INCREMENT'
|
42
|
-
expect(subject.dump).to match_fuzzy
|
42
|
+
expect(subject.dump).to match_fuzzy id_bigint_create_table
|
43
43
|
}
|
44
44
|
end
|
45
45
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
describe 'Ridgepole::Client (with integer pk)', condition: '5.1.' do
|
2
|
+
context 'when with id:integer' do
|
3
|
+
let(:dsl) {
|
4
|
+
<<-RUBY
|
5
|
+
create_table "books", id: :integer, force: :cascade do |t|
|
6
|
+
t.string "title", null: false
|
7
|
+
t.integer "author_id", null: false
|
8
|
+
t.datetime "created_at"
|
9
|
+
t.datetime "updated_at"
|
10
|
+
end
|
11
|
+
RUBY
|
12
|
+
}
|
13
|
+
|
14
|
+
subject { client }
|
15
|
+
|
16
|
+
before { subject.diff(dsl).migrate }
|
17
|
+
|
18
|
+
specify {
|
19
|
+
expect(show_create_table(:books)).to include '`id` int(11) NOT NULL AUTO_INCREMENT'
|
20
|
+
expect(subject.dump).to match_fuzzy dsl
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when without id:integer' do
|
25
|
+
let(:dsl) {
|
26
|
+
<<-RUBY
|
27
|
+
create_table "books", force: :cascade do |t|
|
28
|
+
t.string "title", null: false
|
29
|
+
t.integer "author_id", null: false
|
30
|
+
t.datetime "created_at"
|
31
|
+
t.datetime "updated_at"
|
32
|
+
end
|
33
|
+
RUBY
|
34
|
+
}
|
35
|
+
|
36
|
+
subject { client }
|
37
|
+
|
38
|
+
before { subject.diff(dsl).migrate }
|
39
|
+
|
40
|
+
specify {
|
41
|
+
expect(show_create_table(:books)).to include '`id` bigint(20) NOT NULL AUTO_INCREMENT'
|
42
|
+
expect(subject.dump).to match_fuzzy dsl
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
@@ -11,7 +11,7 @@ describe Ridgepole::Config do
|
|
11
11
|
YAML
|
12
12
|
}
|
13
13
|
let(:env) { 'development' }
|
14
|
-
|
14
|
+
specify {
|
15
15
|
expect(subject['adapter']).to eq "mysql2"
|
16
16
|
expect(subject['encoding']).to eq "utf8"
|
17
17
|
expect(subject['database']).to eq "blog"
|
@@ -29,7 +29,7 @@ describe Ridgepole::Config do
|
|
29
29
|
YAML
|
30
30
|
}
|
31
31
|
let(:env) { 'development' }
|
32
|
-
|
32
|
+
specify {
|
33
33
|
expect(subject['adapter']).to eq "mysql2"
|
34
34
|
expect(subject['encoding']).to eq "utf8"
|
35
35
|
expect(subject['database']).to eq "blog_3"
|
@@ -41,7 +41,7 @@ describe Ridgepole::Config do
|
|
41
41
|
let(:config) {
|
42
42
|
<<-YAML.strip_heredoc
|
43
43
|
development:
|
44
|
-
adapter:
|
44
|
+
adapter: sqlspecifye
|
45
45
|
database: db/sample.db
|
46
46
|
production:
|
47
47
|
adapter: mysql2
|
@@ -53,8 +53,8 @@ describe Ridgepole::Config do
|
|
53
53
|
|
54
54
|
context 'in development env' do
|
55
55
|
let(:env) { 'development' }
|
56
|
-
|
57
|
-
expect(subject['adapter']).to eq "
|
56
|
+
specify {
|
57
|
+
expect(subject['adapter']).to eq "sqlspecifye"
|
58
58
|
expect(subject['database']).to eq "db/sample.db"
|
59
59
|
expect(subject['username']).to be_nil
|
60
60
|
}
|
@@ -62,7 +62,7 @@ describe Ridgepole::Config do
|
|
62
62
|
|
63
63
|
context 'in production env' do
|
64
64
|
let(:env) { 'production' }
|
65
|
-
|
65
|
+
specify {
|
66
66
|
expect(subject['adapter']).to eq "mysql2"
|
67
67
|
expect(subject['encoding']).to eq "utf8"
|
68
68
|
expect(subject['database']).to eq "blog"
|
@@ -101,7 +101,7 @@ describe Ridgepole::Config do
|
|
101
101
|
|
102
102
|
let(:env) { 'development' }
|
103
103
|
|
104
|
-
|
104
|
+
specify {
|
105
105
|
expect {
|
106
106
|
subject
|
107
107
|
}.to raise_error 'Invalid config: "database.yml"'
|