ridgepole 0.5.2.beta → 0.5.2.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e89391bd7d67f71ab9d326e42226fffaa1c23962
4
- data.tar.gz: a1966c6828572057af20625308e2cd53c0d1875e
3
+ metadata.gz: 7736b373af1f2d21a0daac512947613e8b0f177a
4
+ data.tar.gz: f19ee4c3d025fef7fc6937d7d3f83e7da768a196
5
5
  SHA512:
6
- metadata.gz: 33d6c97cf20903b6cbaaf4a2d1a15d6e4c49984011fd443a460cdff5b3a63af6cdf55ed2529674a62fbff468f678da4493bfe6994346ef31fe144396d08f34cf
7
- data.tar.gz: 4dac5448a53e81c93847ae322e07940ec296627c8162afe62acdc406a4925992ca9d7e1e1414dec67c88494662c01704ca51d7d9af758eec305620c750ff2d02
6
+ metadata.gz: d8177bba6eaad6aef5bf8dc07384285310ce7672a1f4028722a25fdfe7b26a1435a601debd1a519d98cdaa49f0376eab8f3850e196fcfaed7b510504e2977585
7
+ data.tar.gz: c8fd2a7892296d7bcb072e1d20fdb047f07a29638d8c74ead934409c77134ba8d6bc254c088920abf4a6249f7a08f3721f42df9f2362e469218e60fdbe404cf1
data/README.md CHANGED
@@ -58,7 +58,6 @@ Usage: ridgepole [options]
58
58
  -e, --export
59
59
  --split
60
60
  --split-with-dir
61
- --without-table-options
62
61
  -d, --diff DSL1 DSL2
63
62
  --reverse
64
63
  --with-apply
@@ -71,6 +70,7 @@ Usage: ridgepole [options]
71
70
  --enable-migration-comments
72
71
  --enable-mysql-awesome
73
72
  --normalize-mysql-float
73
+ --dump-without-table-options
74
74
  -r, --require LIBS
75
75
  --log-file LOG_FILE
76
76
  --verbose
@@ -183,9 +183,20 @@ create_table "articles", force: true, comment: "table comment" do |t|
183
183
  end
184
184
  ```
185
185
 
186
+ ## Collation
187
+ You can use the column collation by passing `--enable-mysql-awesome` ([activerecord-mysql-awesome](https://github.com/kamipo/activerecord-mysql-awesome) is required)
188
+
189
+ ```ruby
190
+ create_table "articles", force: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
191
+ t.string "title", collation: "ascii_bin"
192
+ t.text "text", null: false, collation: "utf8mb4_bin"
193
+ t.datetime "created_at"
194
+ t.datetime "updated_at"
195
+ endend
196
+ ```
197
+
186
198
  ## bigint support
187
199
  Export of `bigint` PK is enabled by passing `--enable-mysql-pkdump` ([activerecord-mysql-pkdump](https://github.com/winebarrel/activerecord-mysql-pkdump) is required)
188
-
189
200
  ```ruby
190
201
  create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
191
202
  t.string "title", null: false
@@ -74,7 +74,6 @@ ARGV.options do |opt|
74
74
  opt.on('-e', '--export') { set_mode[:export] }
75
75
  opt.on('', '--split') {|v| split = true }
76
76
  opt.on('', '--split-with-dir') {|v| split = :with_dir }
77
- opt.on('', '--without-table-options') { options[:without_table_options] = true }
78
77
  opt.on('-d', '--diff DSL1 DSL2') {|diff_arg1|
79
78
  set_mode[:diff]
80
79
  diff_arg2 = ARGV.first
@@ -98,6 +97,7 @@ ARGV.options do |opt|
98
97
  opt.on('', '--enable-migration-comments') { options[:enable_migration_comments] = true }
99
98
  opt.on('', '--enable-mysql-awesome') { options[:enable_mysql_awesome] = true }
100
99
  opt.on('', '--normalize-mysql-float') { options[:normalize_mysql_float] = true }
100
+ opt.on('', '--dump-without-table-options') { options[:dump_without_table_options] = true }
101
101
  opt.on('-r' , '--require LIBS', Array) {|v| v.each {|i| require i } }
102
102
  opt.on('' , '--log-file LOG_FILE') {|v| options[:log_file] = v }
103
103
  opt.on('' , '--verbose') { Ridgepole::Logger.verbose = true }
@@ -35,8 +35,8 @@ class Ridgepole::Dumper
35
35
  line !~ /\AActiveRecord::Schema\.define/ &&
36
36
  line !~ /\Aend/
37
37
  }.map {|line|
38
- if @options[:without_table_options] and line =~ /\A create_table /
39
- line.gsub(/, options: "[^"]*"/, '')
38
+ if @options[:dump_without_table_options] and line =~ /\A create_table /
39
+ line.gsub(/, options: ("(?:[^"]|\")*")/, '')
40
40
  else
41
41
  line
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.5.2.beta'
2
+ VERSION = '0.5.2.beta2'
3
3
  end
@@ -23,7 +23,6 @@ describe 'ridgepole' do
23
23
  -e, --export
24
24
  --split
25
25
  --split-with-dir
26
- --without-table-options
27
26
  -d, --diff DSL1 DSL2
28
27
  --reverse
29
28
  --with-apply
@@ -36,6 +35,7 @@ describe 'ridgepole' do
36
35
  --enable-migration-comments
37
36
  --enable-mysql-awesome
38
37
  --normalize-mysql-float
38
+ --dump-without-table-options
39
39
  -r, --require LIBS
40
40
  --log-file LOG_FILE
41
41
  --verbose
@@ -8,7 +8,7 @@ describe 'Ridgepole::Client.dump' do
8
8
 
9
9
  if mysql_awesome_enabled?
10
10
  opts[:enable_mysql_awesome] = true
11
- opts[:without_table_options] = true
11
+ opts[:dump_without_table_options] = true
12
12
  else
13
13
  opts[:enable_mysql_unsigned] = true
14
14
  end
@@ -0,0 +1,43 @@
1
+ if mysql_awesome_enabled?
2
+ describe 'Ridgepole::Client#dump' do
3
+ let(:actual_dsl) {
4
+ <<-'RUBY'
5
+ create_table "books", force: true, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='\"london\" bridge \"is\" falling \"down\"'" 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
+ context 'when without table options' do
15
+ let(:expected_dsl) {
16
+ <<-RUBY
17
+ create_table "books", force: true do |t|
18
+ t.string "title", null: false
19
+ t.integer "author_id", null: false
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+ RUBY
24
+ }
25
+
26
+ before { subject.diff(actual_dsl).migrate }
27
+ subject { client }
28
+
29
+ it {
30
+ expect(subject.dump).to eq expected_dsl.strip_heredoc.strip
31
+ }
32
+ end
33
+
34
+ context 'when with table options' do
35
+ before { subject.diff(actual_dsl).migrate }
36
+ subject { client(dump_without_table_options: false) }
37
+
38
+ it {
39
+ expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
40
+ }
41
+ end
42
+ end
43
+ end
@@ -55,7 +55,7 @@ def client(options = {}, config = {})
55
55
 
56
56
  if mysql_awesome_enabled?
57
57
  default_options[:enable_mysql_awesome] = true
58
- default_options[:without_table_options] = true
58
+ default_options[:dump_without_table_options] = true
59
59
  else
60
60
  default_options[:enable_mysql_unsigned] = true
61
61
  end
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.5.2.beta
4
+ version: 0.5.2.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: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -207,6 +207,7 @@ files:
207
207
  - spec/dump/dump_class_method_spec.rb
208
208
  - spec/dump/dump_some_tables_spec.rb
209
209
  - spec/dump/dump_spec.rb
210
+ - spec/dump/dump_without_table_options_spec.rb
210
211
  - spec/migrate/check_orphan_index_spec.rb
211
212
  - spec/migrate/migrate_add_column2_spec.rb
212
213
  - spec/migrate/migrate_add_column_spec.rb
@@ -288,6 +289,7 @@ test_files:
288
289
  - spec/dump/dump_class_method_spec.rb
289
290
  - spec/dump/dump_some_tables_spec.rb
290
291
  - spec/dump/dump_spec.rb
292
+ - spec/dump/dump_without_table_options_spec.rb
291
293
  - spec/migrate/check_orphan_index_spec.rb
292
294
  - spec/migrate/migrate_add_column2_spec.rb
293
295
  - spec/migrate/migrate_add_column_spec.rb