flydata 0.1.15 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 79301d111fb0aeb6db055ffadf61d6ea5d6cdad0
4
- data.tar.gz: a3b94bc08132734123e507249c8f878faff9ad97
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDUwYjJjMGE3ZjRkYTU3YmNjNjdlY2Q0MTA4MjNlMjc4NzU1YjY1NA==
5
+ data.tar.gz: !binary |-
6
+ ZWQ0YTM5NzFiM2I3N2U5NGI2NDkwZmEyN2FjMzg3Njc4ODdiOGY3ZQ==
5
7
  SHA512:
6
- metadata.gz: 1a2db9f6bf5fd4c5d9e860b22b6d525831f3f5186edddb7f32066cc2e156706da76878d2e701bcfb902f2336ef8311a6b5a2b5d7dd39c812175db00ac5722578
7
- data.tar.gz: 21c73bef77eff8eddcaae7ddf6e0fda654ff365b78bcbde1c3b7fb1af3987b8f515334ce8cfe217aedfd06262092ebe76935e9a25026dc951801f5eb9177469f
8
+ metadata.gz: !binary |-
9
+ ODJlNDQ0ZGU2ZWM1ODk0MGM2MGIzZjY4YTZiOGE2NmZiOTdhOThmYWYwYWQ0
10
+ MDc4ZjhkOWU3MjY5ODI4NWJkZWFjMmU2YmFkYmY5ZGM1NmI2ZDgzNWJhNDRm
11
+ M2ZhNDU2NzAyMzI1OTc2NWY2MTVjMTQwM2IzNTNlYjBmYmRiMzc=
12
+ data.tar.gz: !binary |-
13
+ MjIxMGJjMTkxYmY4MjQ3ZmY3M2U2NDU1MjYxYWUyMDU4YWYxYmFmOTExY2Ey
14
+ NWUzZmUwOWRhNWNjN2QwZTExYjRkNjU5OWViZTQ2NDJlYWU0ZmI5OWUwZmJl
15
+ NmFiNTAxNGQzMzI0NGFhYTNlM2M1MTg3NmNjMjQ0NTVkOTg5YzM=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.15
1
+ 0.2.0
data/flydata.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: flydata 0.1.15 ruby lib
5
+ # stub: flydata 0.2.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "flydata"
9
- s.version = "0.1.15"
9
+ s.version = "0.2.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Koichi Fujikawa"]
14
- s.date = "2014-08-11"
14
+ s.date = "2014-08-19"
15
15
  s.description = "FlyData Command Line Interface"
16
16
  s.email = "sysadmin@flydata.co"
17
17
  s.executables = ["fdmysqldump", "flydata"]
@@ -32,8 +32,7 @@ module Mysql
32
32
  class FlydataBinlogQueryDispatcher < BinlogQueryDispatcher
33
33
  def initialize(context)
34
34
  @handlers = [
35
- # TODO Uncomment below to enable AlterTable support
36
- # AlterTableQueryHandler.new(context),
35
+ AlterTableQueryHandler.new(context),
37
36
  ]
38
37
  end
39
38
  end
@@ -282,7 +282,7 @@ grammar MysqlAlterTable
282
282
 
283
283
  rule value
284
284
  quoted_value { def raw_value; text_raw_value; end }
285
- / ident { def raw_value; value; end }
285
+ / ident { def raw_value; text_value; end }
286
286
  end
287
287
 
288
288
  rule quoted_value
@@ -151,7 +151,7 @@ class MysqlTableDef
151
151
  case cond
152
152
  when :column_name #`column_name` ...
153
153
  pos = line.index(' ', 1)
154
- column[:name] = if line[0] == '`'
154
+ column[:column] = if line[0] == '`'
155
155
  line[1..pos-2]
156
156
  else
157
157
  line[0..pos-1]
@@ -206,7 +206,7 @@ class MysqlTableDef
206
206
  keys = line.scan(/`(.*?)`/).collect{|item| item[0]}
207
207
  keys.each do |key|
208
208
  column = columns.detect {|column|
209
- column[:name] === key
209
+ column[:column] === key
210
210
  }
211
211
  raise "Key #{key} must exist in the definition " if column.nil?
212
212
  column[type] = true
@@ -103,7 +103,7 @@ EOS
103
103
  else
104
104
  type_info[:type]
105
105
  end
106
- line = %Q| "#{column[:name]}" #{rs_type}|
106
+ line = %Q| "#{column[:column]}" #{rs_type}|
107
107
  line += " NOT NULL" if column[:not_null]
108
108
  if (column.has_key?(:default))
109
109
  val = replace_default_value(type_info[:type], column[:default])
@@ -127,7 +127,7 @@ EOS
127
127
  end
128
128
 
129
129
  def self.primary_key_sql(flydata_tabledef)
130
- pks = flydata_tabledef[:columns].select{|col| col[:primary_key]}.collect{|col| col[:name]}
130
+ pks = flydata_tabledef[:columns].select{|col| col[:primary_key]}.collect{|col| col[:column]}
131
131
  pks.empty? ? nil : " PRIMARY KEY (#{pks.join(',')})"
132
132
  end
133
133
 
@@ -137,7 +137,7 @@ EOS
137
137
  next unless col[:comment]
138
138
 
139
139
  sql += <<EOS
140
- COMMENT ON COLUMN #{table_name_for_ddl(flydata_tabledef[:table_name], schema_name)}."#{col[:name]}"
140
+ COMMENT ON COLUMN #{table_name_for_ddl(flydata_tabledef[:table_name], schema_name)}."#{col[:column]}"
141
141
  IS '#{col[:comment]}';
142
142
  EOS
143
143
  end
@@ -153,7 +153,7 @@ EOS
153
153
  sql = FLYDATA_CTL_COLUMNS_SQL % [ flydata_ctl_tbl, flydata_tabledef[:table_name], flydata_ctl_tbl ]
154
154
  values = []
155
155
  flydata_tabledef[:columns].each.with_index(1) do |col, i|
156
- values << "('#{flydata_tabledef[:table_name]}', '#{col[:name]}', '#{escape(col[:type])}', #{i})"
156
+ values << "('#{flydata_tabledef[:table_name]}', '#{col[:column]}', '#{escape(col[:type])}', #{i})"
157
157
  end
158
158
  sql += values.join(",\n") + ';'
159
159
  sql
@@ -31,6 +31,23 @@ describe 'MysqlAlterTableParser' do
31
31
  end
32
32
  end
33
33
 
34
+ context 'with different column types' do
35
+ context 'with longblob' do
36
+ let(:query) { "alter table test_table add column value longblob" }
37
+ it do
38
+ expect(subject).to eq({
39
+ type: :alter_table,
40
+ table_name: "test_table",
41
+ actions: [{
42
+ action: :add_column,
43
+ column: "value",
44
+ type: "varbinary(4294967295)"
45
+ }]
46
+ })
47
+ end
48
+ end
49
+ end
50
+
34
51
  context 'without the keyword "COLUMN"' do
35
52
  let(:query) { "alter table test_table add value varchar(26)" }
36
53
  it do
@@ -192,6 +209,22 @@ describe 'MysqlAlterTableParser' do
192
209
  })
193
210
  end
194
211
  end
212
+
213
+ context 'with default option taking an unquoted parameter' do
214
+ let(:query) { "alter table test_table add column updated_at timestamp default current_timestamp" }
215
+ it do
216
+ expect(subject).to eq({
217
+ type: :alter_table,
218
+ table_name: "test_table",
219
+ actions: [{
220
+ action: :add_column,
221
+ column: "updated_at",
222
+ type: "datetime",
223
+ default: "current_timestamp",
224
+ }]
225
+ })
226
+ end
227
+ end
195
228
  end
196
229
 
197
230
 
@@ -30,33 +30,33 @@ describe MysqlTableDef do
30
30
  it 'should set correct table name' do
31
31
  expect(subject[:columns]).to eq(
32
32
  [
33
- {:name=>"id", :type=>"int8(20)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
34
- {:name=>"col_binary", :type=>"binary(100)", :default=>nil},
35
- {:name=>"col_blob", :type=>"varbinary(65535)"},
36
- {:name=>"col_bool", :type=>"int1(1)", :default=>"0"},
37
- {:name=>"col_char", :type=>"varchar(18)", :default=>nil},
38
- {:name=>"col_date", :type=>"date", :default=>nil},
39
- {:name=>"col_datetime", :type=>"datetime", :default=>nil},
40
- {:name=>"col_decimal", :type=>"numeric(5,2)", :default=>nil},
41
- {:name=>"col_double", :type=>"float8", :default=>nil},
42
- {:name=>"col_float", :type=>"float4", :default=>nil},
43
- {:name=>"col_float_4_2", :type=>"float4(4,2)", :default=>nil},
44
- {:name=>"col_int", :type=>"int4(11)", :default=>nil},
45
- {:name=>"col_int_6", :type=>"int4(6)", :default=>nil},
46
- {:name=>"col_longblob", :type=>"varbinary(4294967295)"},
47
- {:name=>"col_longtext", :type=>"text"},
48
- {:name=>"col_mediumblob", :type=>"varbinary(16777215)"},
49
- {:name=>"col_mediumint", :type=>"int3(9)", :default=>nil},
50
- {:name=>"col_mediumtext", :type=>"text"},
51
- {:name=>"col_smallint", :type=>"int2(6)", :default=>nil},
52
- {:name=>"col_text", :type=>"text"},
53
- {:name=>"col_time", :type=>"time", :default=>nil},
54
- {:name=>"col_timestamp", :type=>"datetime", :not_null=>true, :default=>"CURRENT_TIMESTAMP"},
55
- {:name=>"col_tinyblob", :type=>"varbinary(255)"},
56
- {:name=>"col_tinyint", :type=>"int1(4)", :default=>nil},
57
- {:name=>"col_tinytext", :type=>"text"},
58
- {:name=>"col_varbinary", :type=>"varbinary(255)", :default=>nil},
59
- {:name=>"col_varchar", :type=>"varchar(372)", :default=>nil}
33
+ {:column=>"id", :type=>"int8(20)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
34
+ {:column=>"col_binary", :type=>"binary(100)", :default=>nil},
35
+ {:column=>"col_blob", :type=>"varbinary(65535)"},
36
+ {:column=>"col_bool", :type=>"int1(1)", :default=>"0"},
37
+ {:column=>"col_char", :type=>"varchar(18)", :default=>nil},
38
+ {:column=>"col_date", :type=>"date", :default=>nil},
39
+ {:column=>"col_datetime", :type=>"datetime", :default=>nil},
40
+ {:column=>"col_decimal", :type=>"numeric(5,2)", :default=>nil},
41
+ {:column=>"col_double", :type=>"float8", :default=>nil},
42
+ {:column=>"col_float", :type=>"float4", :default=>nil},
43
+ {:column=>"col_float_4_2", :type=>"float4(4,2)", :default=>nil},
44
+ {:column=>"col_int", :type=>"int4(11)", :default=>nil},
45
+ {:column=>"col_int_6", :type=>"int4(6)", :default=>nil},
46
+ {:column=>"col_longblob", :type=>"varbinary(4294967295)"},
47
+ {:column=>"col_longtext", :type=>"text"},
48
+ {:column=>"col_mediumblob", :type=>"varbinary(16777215)"},
49
+ {:column=>"col_mediumint", :type=>"int3(9)", :default=>nil},
50
+ {:column=>"col_mediumtext", :type=>"text"},
51
+ {:column=>"col_smallint", :type=>"int2(6)", :default=>nil},
52
+ {:column=>"col_text", :type=>"text"},
53
+ {:column=>"col_time", :type=>"time", :default=>nil},
54
+ {:column=>"col_timestamp", :type=>"datetime", :not_null=>true, :default=>"CURRENT_TIMESTAMP"},
55
+ {:column=>"col_tinyblob", :type=>"varbinary(255)"},
56
+ {:column=>"col_tinyint", :type=>"int1(4)", :default=>nil},
57
+ {:column=>"col_tinytext", :type=>"text"},
58
+ {:column=>"col_varbinary", :type=>"varbinary(255)", :default=>nil},
59
+ {:column=>"col_varchar", :type=>"varchar(372)", :default=>nil}
60
60
  ]
61
61
  )
62
62
  end
@@ -82,9 +82,9 @@ describe MysqlTableDef do
82
82
  it 'comment should be set' do
83
83
  expect(subject[:columns]).to eq(
84
84
  [
85
- {:name=>"id", :type=>"int4(11)", :not_null=>true, :default=>"0",
85
+ {:column=>"id", :type=>"int4(11)", :not_null=>true, :default=>"0",
86
86
  :comment=>"this is primary key", :primary_key=>true},
87
- {:name=>"value", :type=>"text"}
87
+ {:column=>"value", :type=>"text"}
88
88
  ]
89
89
  )
90
90
  end
@@ -95,9 +95,9 @@ describe MysqlTableDef do
95
95
  it 'multi pk should be set' do
96
96
  expect(subject[:columns]).to eq(
97
97
  [
98
- {:name=>"id1", :type=>"int4(11)", :not_null=>true, :default=>"0", :primary_key=>true},
99
- {:name=>"id2", :type=>"int4(11)", :not_null=>true, :default=>"0", :primary_key=>true},
100
- {:name=>"value", :type=>"text"}
98
+ {:column=>"id1", :type=>"int4(11)", :not_null=>true, :default=>"0", :primary_key=>true},
99
+ {:column=>"id2", :type=>"int4(11)", :not_null=>true, :default=>"0", :primary_key=>true},
100
+ {:column=>"value", :type=>"text"}
101
101
  ]
102
102
  )
103
103
  end
@@ -108,10 +108,10 @@ describe MysqlTableDef do
108
108
  it 'enum columns should be parsed' do
109
109
  expect(subject[:columns]).to eq(
110
110
  [
111
- {:name=>"id", :type=>"int4(11)", :not_null=>true, :primary_key=>true},
112
- {:name=>"enum_1", :type=>"enum('apple','orange','banana')", :default=>nil},
113
- {:name=>"enum_2", :type=>"enum('a','b','c')", :default=>"a"},
114
- {:name=>"enum_3", :type=>"enum('e','f','g')", :not_null=>true},
111
+ {:column=>"id", :type=>"int4(11)", :not_null=>true, :primary_key=>true},
112
+ {:column=>"enum_1", :type=>"enum('apple','orange','banana')", :default=>nil},
113
+ {:column=>"enum_2", :type=>"enum('a','b','c')", :default=>"a"},
114
+ {:column=>"enum_3", :type=>"enum('e','f','g')", :not_null=>true},
115
115
  ]
116
116
  )
117
117
  end
@@ -122,10 +122,10 @@ describe MysqlTableDef do
122
122
  it 'should parse the dump correctly' do
123
123
  expect(subject[:columns]).to eq(
124
124
  [
125
- {:name=>"no", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
126
- {:name=>"product_category", :type=>"int4(11)", :not_null=>true},
127
- {:name=>"product_id", :type=>"int4(11)", :not_null=>true},
128
- {:name=>"customer_id", :type=>"int4(11)", :not_null=>true},
125
+ {:column=>"no", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
126
+ {:column=>"product_category", :type=>"int4(11)", :not_null=>true},
127
+ {:column=>"product_id", :type=>"int4(11)", :not_null=>true},
128
+ {:column=>"customer_id", :type=>"int4(11)", :not_null=>true},
129
129
  ]
130
130
  )
131
131
  end
@@ -136,13 +136,13 @@ describe MysqlTableDef do
136
136
  it 'should include unsigned in column type' do
137
137
  expect(subject[:columns]).to eq(
138
138
  [
139
- {:name=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
140
- {:name=>"value_int", :type=>"int4(10) unsigned", :default=>nil},
141
- {:name=>"value_float", :type=>"float4 unsigned", :default=>nil},
142
- {:name=>"value_dec", :type=>"numeric(10,2) unsigned", :default=>nil},
143
- {:name=>"value_double", :type=>"float8 unsigned", :default=>nil},
144
- {:name=>"name", :type=>"varchar(768)", :default=>nil},
145
- {:name=>"value_small_int", :type=>"int2(5) unsigned", :default=>nil}
139
+ {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
140
+ {:column=>"value_int", :type=>"int4(10) unsigned", :default=>nil},
141
+ {:column=>"value_float", :type=>"float4 unsigned", :default=>nil},
142
+ {:column=>"value_dec", :type=>"numeric(10,2) unsigned", :default=>nil},
143
+ {:column=>"value_double", :type=>"float8 unsigned", :default=>nil},
144
+ {:column=>"name", :type=>"varchar(768)", :default=>nil},
145
+ {:column=>"value_small_int", :type=>"int2(5) unsigned", :default=>nil}
146
146
  ]
147
147
  )
148
148
  end
@@ -153,10 +153,10 @@ describe MysqlTableDef do
153
153
  it 'should include unique in column def' do
154
154
  expect(subject[:columns]).to eq(
155
155
  [
156
- {:name=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
157
- {:name=>"title", :type=>"varchar(768)", :unique=>true, :default=>nil},
158
- {:name=>"name", :type=>"text"},
159
- {:name=>"num", :type=>"int4(11)", :unique=>true, :default=>nil}
156
+ {:column=>"id", :type=>"int4(11)", :auto_increment=>true, :not_null=>true, :primary_key=>true},
157
+ {:column=>"title", :type=>"varchar(768)", :unique=>true, :default=>nil},
158
+ {:column=>"name", :type=>"text"},
159
+ {:column=>"num", :type=>"int4(11)", :unique=>true, :default=>nil}
160
160
  ]
161
161
  )
162
162
  end
@@ -10,8 +10,9 @@ describe RedshiftTableDef do
10
10
  let(:flydata_tabledef) { {
11
11
  table_name: "test_table",
12
12
  columns: [
13
- { name: "id", type: "int4(11)", not_null: true, primary_key: true },
14
- { name: "value", type: "text" },
13
+ { column: "id", type: "int4(11)", not_null: true, primary_key: true },
14
+ { column: "age", type: "int4(11) unsigned" },
15
+ { column: "value", type: "text" },
15
16
  ],
16
17
  default_charset: "utf8;"} }
17
18
  let(:option) { { flydata_ctl_table: false } }
@@ -24,13 +25,15 @@ describe RedshiftTableDef do
24
25
  DROP TABLE "test_table";
25
26
  CREATE TABLE "test_table" (
26
27
  "id" int4 NOT NULL,
28
+ "age" int8,
27
29
  "value" varchar(max),
28
30
  PRIMARY KEY (id)
29
31
  );
30
32
  DELETE FROM "flydata_ctl_columns" WHERE table_name = 'test_table';
31
33
  INSERT INTO "flydata_ctl_columns" (table_name, column_name, src_data_type, ordinal_position) VALUES
32
34
  ('test_table', 'id', 'int4(11)', 1),
33
- ('test_table', 'value', 'text', 2);
35
+ ('test_table', 'age', 'int4(11) unsigned', 2),
36
+ ('test_table', 'value', 'text', 3);
34
37
  EOT
35
38
  end
36
39
  end
@@ -53,13 +56,15 @@ CREATE TABLE "flydata_ctl_columns"(
53
56
  DROP TABLE "test_table";
54
57
  CREATE TABLE "test_table" (
55
58
  "id" int4 NOT NULL,
59
+ "age" int8,
56
60
  "value" varchar(max),
57
61
  PRIMARY KEY (id)
58
62
  );
59
63
  DELETE FROM "flydata_ctl_columns" WHERE table_name = 'test_table';
60
64
  INSERT INTO "flydata_ctl_columns" (table_name, column_name, src_data_type, ordinal_position) VALUES
61
65
  ('test_table', 'id', 'int4(11)', 1),
62
- ('test_table', 'value', 'text', 2);
66
+ ('test_table', 'age', 'int4(11) unsigned', 2),
67
+ ('test_table', 'value', 'text', 3);
63
68
  EOT
64
69
  end
65
70
  end
@@ -68,9 +73,9 @@ EOT
68
73
  let(:flydata_tabledef) { {
69
74
  table_name: "test_table",
70
75
  columns: [
71
- { name: "id", type: "int4(11)", not_null: true, primary_key: true },
72
- { name: "value", type: "text" },
73
- { name: "cmnt", type: "text", comment: "helloworld" },
76
+ { column: "id", type: "int4(11)", not_null: true, primary_key: true },
77
+ { column: "value", type: "text" },
78
+ { column: "cmnt", type: "text", comment: "helloworld" },
74
79
  ],
75
80
  default_charset: "utf8;"} }
76
81
 
@@ -98,9 +103,9 @@ EOT
98
103
  let(:flydata_tabledef) { {
99
104
  table_name: "test_table",
100
105
  columns: [
101
- { name: "id", type: "int4(11)", not_null: true, primary_key: true },
102
- { name: "value", type: "text" },
103
- { name: "cmnt", type: "text", comment: "helloworld" },
106
+ { column: "id", type: "int4(11)", not_null: true, primary_key: true },
107
+ { column: "value", type: "text" },
108
+ { column: "cmnt", type: "text", comment: "helloworld" },
104
109
  ],
105
110
  default_charset: "utf8;"} }
106
111
  let(:option) { { flydata_ctl_table: true, schema_name: 'test_schema' } }
@@ -142,21 +147,21 @@ EOT
142
147
 
143
148
  context 'with varchar column def' do
144
149
  context 'when size is smaller than max size' do
145
- let(:column) { {:name=>"col_char", :type=>"varchar(18)", :default=>nil} }
150
+ let(:column) { {:column=>"col_char", :type=>"varchar(18)", :default=>nil} }
146
151
  it do
147
152
  expect(subject).to eq(' "col_char" varchar(18) DEFAULT NULL')
148
153
  end
149
154
  end
150
155
 
151
156
  context 'when size exceeds varchar max size' do
152
- let(:column) { {:name=>"col_char", :type=>"varchar(1000000000)", :default=>nil} }
157
+ let(:column) { {:column=>"col_char", :type=>"varchar(1000000000)", :default=>nil} }
153
158
  it do
154
159
  expect(subject).to eq(' "col_char" varchar(65535) DEFAULT NULL')
155
160
  end
156
161
  end
157
162
 
158
163
  context 'when size is max size' do
159
- let(:column) { {:name=>"col_char", :type=>"varchar(max)", :default=>nil} }
164
+ let(:column) { {:column=>"col_char", :type=>"varchar(max)", :default=>nil} }
160
165
  it do
161
166
  expect(subject).to eq(' "col_char" varchar(max) DEFAULT NULL')
162
167
  end
@@ -165,7 +170,7 @@ EOT
165
170
 
166
171
  context 'with medium blob column def' do
167
172
  context 'when size exceeds max size' do
168
- let(:column) { {:name=>"col_medium_blob", :type=>"varbinary(16777215)", :default=>nil} }
173
+ let(:column) { {:column=>"col_medium_blob", :type=>"varbinary(16777215)", :default=>nil} }
169
174
  it do
170
175
  expect(subject).to eq(' "col_medium_blob" varchar(65535) DEFAULT NULL')
171
176
  end
@@ -173,7 +178,7 @@ EOT
173
178
  end
174
179
 
175
180
  context 'with unsigned column def' do
176
- let(:column) { {:name=>"value_small_int", :type=>"int2(5) unsigned", :default=>nil} }
181
+ let(:column) { {:column=>"value_small_int", :type=>"int2(5) unsigned", :default=>nil} }
177
182
  it do
178
183
  expect(subject).to eq(' "value_small_int" int4 DEFAULT NULL')
179
184
  end
@@ -181,27 +186,27 @@ EOT
181
186
 
182
187
  context 'with decimal column def' do
183
188
  context 'when precision exceeds max allowed' do
184
- let(:column) { {:name=>"value", :type=>"numeric(65,30)", :default=>nil} }
189
+ let(:column) { {:column=>"value", :type=>"numeric(65,30)", :default=>nil} }
185
190
  it 'should replace precision with max value' do
186
191
  expect(subject).to eq(' "value" numeric(38,30) DEFAULT NULL')
187
192
  end
188
193
  end
189
194
  context 'when scale exceeds max allowed' do #not possible
190
- let(:column) { {:name=>"value", :type=>"numeric(45,44)", :default=>nil} }
195
+ let(:column) { {:column=>"value", :type=>"numeric(45,44)", :default=>nil} }
191
196
  it 'should replace scale with max value' do
192
197
  expect(subject).to eq(' "value" numeric(38,37) DEFAULT NULL')
193
198
  end
194
199
  end
195
200
 
196
201
  context 'when precision and scale exceeds max allowed (for unsigned)' do
197
- let(:column) { {:name=>"value", :type=>"numeric(65,44) unsigned", :default=>nil} }
202
+ let(:column) { {:column=>"value", :type=>"numeric(65,44) unsigned", :default=>nil} }
198
203
  it 'should replace precision with max value' do
199
204
  expect(subject).to eq(' "value" numeric(38,37) DEFAULT NULL')
200
205
  end
201
206
  end
202
207
 
203
208
  context 'when precision and scale are within limit (for unsigned)' do
204
- let(:column) { {:name=>"value", :type=>"numeric(37,29) unsigned", :default=>nil} }
209
+ let(:column) { {:column=>"value", :type=>"numeric(37,29) unsigned", :default=>nil} }
205
210
  it 'should do nothing' do
206
211
  expect(subject).to eq(' "value" numeric(37,29) DEFAULT NULL')
207
212
  end
metadata CHANGED
@@ -1,107 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flydata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Fujikawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-11 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.7
20
- - - "~>"
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
22
  version: '1.6'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.6.7
30
- - - "~>"
30
+ - - ~>
31
31
  - !ruby/object:Gem::Version
32
32
  version: '1.6'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: i18n
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - ! '>='
38
38
  - !ruby/object:Gem::Version
39
39
  version: 0.6.5
40
- - - "~>"
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0.6'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
47
+ - - ! '>='
48
48
  - !ruby/object:Gem::Version
49
49
  version: 0.6.5
50
- - - "~>"
50
+ - - ~>
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0.6'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: activesupport
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ~>
58
58
  - !ruby/object:Gem::Version
59
59
  version: 4.0.0
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - "~>"
64
+ - - ~>
65
65
  - !ruby/object:Gem::Version
66
66
  version: 4.0.0
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: json
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - ">="
71
+ - - ! '>='
72
72
  - !ruby/object:Gem::Version
73
73
  version: 1.8.0
74
- - - "~>"
74
+ - - ~>
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.8'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - ! '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.8.0
84
- - - "~>"
84
+ - - ~>
85
85
  - !ruby/object:Gem::Version
86
86
  version: '1.8'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: highline
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
91
+ - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: 1.6.19
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.6'
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ! '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.6.19
104
- - - "~>"
104
+ - - ~>
105
105
  - !ruby/object:Gem::Version
106
106
  version: '1.6'
107
107
  - !ruby/object:Gem::Dependency
@@ -122,254 +122,254 @@ dependencies:
122
122
  name: ruby-binlog
123
123
  requirement: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ">="
125
+ - - ! '>='
126
126
  - !ruby/object:Gem::Version
127
127
  version: 1.0.1
128
- - - "~>"
128
+ - - ~>
129
129
  - !ruby/object:Gem::Version
130
130
  version: '1.0'
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - ">="
135
+ - - ! '>='
136
136
  - !ruby/object:Gem::Version
137
137
  version: 1.0.1
138
- - - "~>"
138
+ - - ~>
139
139
  - !ruby/object:Gem::Version
140
140
  version: '1.0'
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: fluent-plugin-mysql-binlog
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - ">="
145
+ - - ! '>='
146
146
  - !ruby/object:Gem::Version
147
147
  version: 0.0.2
148
- - - "~>"
148
+ - - ~>
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0.0'
151
151
  type: :runtime
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - ">="
155
+ - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: 0.0.2
158
- - - "~>"
158
+ - - ~>
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0.0'
161
161
  - !ruby/object:Gem::Dependency
162
162
  name: mysql2
163
163
  requirement: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">="
165
+ - - ! '>='
166
166
  - !ruby/object:Gem::Version
167
167
  version: 0.3.11
168
- - - "~>"
168
+ - - ~>
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0.3'
171
171
  type: :runtime
172
172
  prerelease: false
173
173
  version_requirements: !ruby/object:Gem::Requirement
174
174
  requirements:
175
- - - ">="
175
+ - - ! '>='
176
176
  - !ruby/object:Gem::Version
177
177
  version: 0.3.11
178
- - - "~>"
178
+ - - ~>
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0.3'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: slop
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - ! '>='
186
186
  - !ruby/object:Gem::Version
187
187
  version: 3.4.6
188
- - - "~>"
188
+ - - ~>
189
189
  - !ruby/object:Gem::Version
190
190
  version: '3.4'
191
191
  type: :runtime
192
192
  prerelease: false
193
193
  version_requirements: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - ">="
195
+ - - ! '>='
196
196
  - !ruby/object:Gem::Version
197
197
  version: 3.4.6
198
- - - "~>"
198
+ - - ~>
199
199
  - !ruby/object:Gem::Version
200
200
  version: '3.4'
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: treetop
203
203
  requirement: !ruby/object:Gem::Requirement
204
204
  requirements:
205
- - - ">="
205
+ - - ! '>='
206
206
  - !ruby/object:Gem::Version
207
207
  version: 1.5.3
208
- - - "~>"
208
+ - - ~>
209
209
  - !ruby/object:Gem::Version
210
210
  version: '1.5'
211
211
  type: :runtime
212
212
  prerelease: false
213
213
  version_requirements: !ruby/object:Gem::Requirement
214
214
  requirements:
215
- - - ">="
215
+ - - ! '>='
216
216
  - !ruby/object:Gem::Version
217
217
  version: 1.5.3
218
- - - "~>"
218
+ - - ~>
219
219
  - !ruby/object:Gem::Version
220
220
  version: '1.5'
221
221
  - !ruby/object:Gem::Dependency
222
222
  name: jeweler
223
223
  requirement: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - ">="
225
+ - - ! '>='
226
226
  - !ruby/object:Gem::Version
227
227
  version: 1.8.8
228
- - - "~>"
228
+ - - ~>
229
229
  - !ruby/object:Gem::Version
230
230
  version: '1.8'
231
231
  type: :development
232
232
  prerelease: false
233
233
  version_requirements: !ruby/object:Gem::Requirement
234
234
  requirements:
235
- - - ">="
235
+ - - ! '>='
236
236
  - !ruby/object:Gem::Version
237
237
  version: 1.8.8
238
- - - "~>"
238
+ - - ~>
239
239
  - !ruby/object:Gem::Version
240
240
  version: '1.8'
241
241
  - !ruby/object:Gem::Dependency
242
242
  name: rspec
243
243
  requirement: !ruby/object:Gem::Requirement
244
244
  requirements:
245
- - - "~>"
245
+ - - ~>
246
246
  - !ruby/object:Gem::Version
247
247
  version: '3.0'
248
248
  type: :development
249
249
  prerelease: false
250
250
  version_requirements: !ruby/object:Gem::Requirement
251
251
  requirements:
252
- - - "~>"
252
+ - - ~>
253
253
  - !ruby/object:Gem::Version
254
254
  version: '3.0'
255
255
  - !ruby/object:Gem::Dependency
256
256
  name: timecop
257
257
  requirement: !ruby/object:Gem::Requirement
258
258
  requirements:
259
- - - ">="
259
+ - - ! '>='
260
260
  - !ruby/object:Gem::Version
261
261
  version: 0.7.1
262
- - - "~>"
262
+ - - ~>
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0.7'
265
265
  type: :development
266
266
  prerelease: false
267
267
  version_requirements: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - ">="
269
+ - - ! '>='
270
270
  - !ruby/object:Gem::Version
271
271
  version: 0.7.1
272
- - - "~>"
272
+ - - ~>
273
273
  - !ruby/object:Gem::Version
274
274
  version: '0.7'
275
275
  - !ruby/object:Gem::Dependency
276
276
  name: sqlite3
277
277
  requirement: !ruby/object:Gem::Requirement
278
278
  requirements:
279
- - - ">="
279
+ - - ! '>='
280
280
  - !ruby/object:Gem::Version
281
281
  version: 1.3.9
282
- - - "~>"
282
+ - - ~>
283
283
  - !ruby/object:Gem::Version
284
284
  version: '1.3'
285
285
  type: :development
286
286
  prerelease: false
287
287
  version_requirements: !ruby/object:Gem::Requirement
288
288
  requirements:
289
- - - ">="
289
+ - - ! '>='
290
290
  - !ruby/object:Gem::Version
291
291
  version: 1.3.9
292
- - - "~>"
292
+ - - ~>
293
293
  - !ruby/object:Gem::Version
294
294
  version: '1.3'
295
295
  - !ruby/object:Gem::Dependency
296
296
  name: ruby-prof
297
297
  requirement: !ruby/object:Gem::Requirement
298
298
  requirements:
299
- - - ">="
299
+ - - ! '>='
300
300
  - !ruby/object:Gem::Version
301
301
  version: 0.15.1
302
- - - "~>"
302
+ - - ~>
303
303
  - !ruby/object:Gem::Version
304
304
  version: '0.15'
305
305
  type: :development
306
306
  prerelease: false
307
307
  version_requirements: !ruby/object:Gem::Requirement
308
308
  requirements:
309
- - - ">="
309
+ - - ! '>='
310
310
  - !ruby/object:Gem::Version
311
311
  version: 0.15.1
312
- - - "~>"
312
+ - - ~>
313
313
  - !ruby/object:Gem::Version
314
314
  version: '0.15'
315
315
  - !ruby/object:Gem::Dependency
316
316
  name: activemodel
317
317
  requirement: !ruby/object:Gem::Requirement
318
318
  requirements:
319
- - - ">="
319
+ - - ! '>='
320
320
  - !ruby/object:Gem::Version
321
321
  version: 4.0.0
322
- - - "~>"
322
+ - - ~>
323
323
  - !ruby/object:Gem::Version
324
324
  version: '4.0'
325
325
  type: :development
326
326
  prerelease: false
327
327
  version_requirements: !ruby/object:Gem::Requirement
328
328
  requirements:
329
- - - ">="
329
+ - - ! '>='
330
330
  - !ruby/object:Gem::Version
331
331
  version: 4.0.0
332
- - - "~>"
332
+ - - ~>
333
333
  - !ruby/object:Gem::Version
334
334
  version: '4.0'
335
335
  - !ruby/object:Gem::Dependency
336
336
  name: activerecord
337
337
  requirement: !ruby/object:Gem::Requirement
338
338
  requirements:
339
- - - ">="
339
+ - - ! '>='
340
340
  - !ruby/object:Gem::Version
341
341
  version: 4.0.0
342
- - - "~>"
342
+ - - ~>
343
343
  - !ruby/object:Gem::Version
344
344
  version: '4.0'
345
345
  type: :development
346
346
  prerelease: false
347
347
  version_requirements: !ruby/object:Gem::Requirement
348
348
  requirements:
349
- - - ">="
349
+ - - ! '>='
350
350
  - !ruby/object:Gem::Version
351
351
  version: 4.0.0
352
- - - "~>"
352
+ - - ~>
353
353
  - !ruby/object:Gem::Version
354
354
  version: '4.0'
355
355
  - !ruby/object:Gem::Dependency
356
356
  name: protected_attributes
357
357
  requirement: !ruby/object:Gem::Requirement
358
358
  requirements:
359
- - - ">="
359
+ - - ! '>='
360
360
  - !ruby/object:Gem::Version
361
361
  version: 1.0.8
362
- - - "~>"
362
+ - - ~>
363
363
  - !ruby/object:Gem::Version
364
364
  version: '1.0'
365
365
  type: :development
366
366
  prerelease: false
367
367
  version_requirements: !ruby/object:Gem::Requirement
368
368
  requirements:
369
- - - ">="
369
+ - - ! '>='
370
370
  - !ruby/object:Gem::Version
371
371
  version: 1.0.8
372
- - - "~>"
372
+ - - ~>
373
373
  - !ruby/object:Gem::Version
374
374
  version: '1.0'
375
375
  description: FlyData Command Line Interface
@@ -380,8 +380,8 @@ executables:
380
380
  extensions: []
381
381
  extra_rdoc_files: []
382
382
  files:
383
- - ".gitignore"
384
- - ".rspec"
383
+ - .gitignore
384
+ - .rspec
385
385
  - Gemfile
386
386
  - Gemfile.lock
387
387
  - Rakefile
@@ -477,12 +477,12 @@ require_paths:
477
477
  - lib
478
478
  required_ruby_version: !ruby/object:Gem::Requirement
479
479
  requirements:
480
- - - ">="
480
+ - - ! '>='
481
481
  - !ruby/object:Gem::Version
482
482
  version: '0'
483
483
  required_rubygems_version: !ruby/object:Gem::Requirement
484
484
  requirements:
485
- - - ">="
485
+ - - ! '>='
486
486
  - !ruby/object:Gem::Version
487
487
  version: '0'
488
488
  requirements: []