flydata 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source "http://rubygems.org"
2
+ source "https://rubygems.flydata.com"
2
3
 
3
4
  gem "rest-client", "~> 1.6.7"
4
5
  gem "i18n", "~> 0.6.5"
@@ -6,7 +7,7 @@ gem "activesupport", "~> 4.0.0"
6
7
  gem "json", "~> 1.8.0"
7
8
  gem "highline", "~> 1.6.19"
8
9
  gem "fluentd", "0.10.35"
9
- gem "ruby-binlog", ">= 1.0.0", :git => "https://github.com/hapyrus/ruby-binlog.git"
10
+ gem "ruby-binlog", ">= 1.0.0"
10
11
  gem "fluent-plugin-mysql-binlog", "~> 0.0.2"
11
12
  gem "mysql2", "~> 0.3.11"
12
13
 
@@ -1,11 +1,6 @@
1
- GIT
2
- remote: https://github.com/hapyrus/ruby-binlog.git
3
- revision: e381b4fc411ca2c2402aefc25809ac3c97d75f94
4
- specs:
5
- ruby-binlog (1.0.0)
6
-
7
1
  GEM
8
2
  remote: http://rubygems.org/
3
+ remote: https://rubygems.flydata.com/
9
4
  specs:
10
5
  activemodel (4.0.0)
11
6
  activesupport (= 4.0.0)
@@ -100,6 +95,7 @@ GEM
100
95
  rspec-expectations (2.14.3)
101
96
  diff-lcs (>= 1.1.3, < 2.0)
102
97
  rspec-mocks (2.14.3)
98
+ ruby-binlog (1.0.0)
103
99
  ruby-prof (0.14.2)
104
100
  sqlite3 (1.3.8)
105
101
  thread_safe (0.1.3)
@@ -126,7 +122,7 @@ DEPENDENCIES
126
122
  protected_attributes
127
123
  rest-client (~> 1.6.7)
128
124
  rspec
129
- ruby-binlog (>= 1.0.0)!
125
+ ruby-binlog (>= 1.0.0)
130
126
  ruby-prof
131
127
  sqlite3
132
128
  timecop
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -46,13 +46,13 @@ command += " " + ARGV.join(' ')
46
46
  IO.popen(command, 'r') do |io|
47
47
  create_flydata_ctl_table = true
48
48
  while !io.eof?
49
- mysql_tabledef = Flydata::Sync::MysqlTableDef.create(io)
49
+ mysql_tabledef = Flydata::TableDef::MysqlTableDef.create(io)
50
50
  if mysql_tabledef.nil?
51
51
  # stream had no more create table definition
52
52
  break
53
53
  end
54
54
  flydata_tabledef = mysql_tabledef.to_flydata_tabledef
55
- puts Flydata::Sync::RedshiftTableDef.from_flydata_tabledef(flydata_tabledef, flydata_ctl_table: create_flydata_ctl_table)
55
+ puts Flydata::TableDef::RedshiftTableDef.from_flydata_tabledef(flydata_tabledef, flydata_ctl_table: create_flydata_ctl_table)
56
56
  create_flydata_ctl_table = false
57
57
  end
58
58
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "flydata"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Koichi Fujikawa"]
12
- s.date = "2014-04-18"
12
+ s.date = "2014-05-01"
13
13
  s.description = "FlyData Command Line Interface"
14
14
  s.email = "sysadmin@flydata.co"
15
15
  s.executables = ["fdmysqldump", "flydata"]
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
43
43
  "lib/flydata/command/setlogdel.rb",
44
44
  "lib/flydata/command/setup.rb",
45
45
  "lib/flydata/command/start.rb",
46
+ "lib/flydata/command/status.rb",
46
47
  "lib/flydata/command/stop.rb",
47
48
  "lib/flydata/command/sync.rb",
48
49
  "lib/flydata/command/version.rb",
@@ -71,6 +72,12 @@ Gem::Specification.new do |s|
71
72
  "spec/flydata/command/sync_spec.rb",
72
73
  "spec/flydata/fluent-plugins/in_mysql_binlog_flydata_spec.rb",
73
74
  "spec/flydata/heroku_spec.rb",
75
+ "spec/flydata/table_def/mysql_table_def_spec.rb",
76
+ "spec/flydata/table_def/mysqldump_test_table_all.dump",
77
+ "spec/flydata/table_def/mysqldump_test_table_column_comment.dump",
78
+ "spec/flydata/table_def/mysqldump_test_table_enum.dump",
79
+ "spec/flydata/table_def/mysqldump_test_table_multi_pk.dump",
80
+ "spec/flydata/table_def/mysqldump_test_table_no_pk.dump",
74
81
  "spec/flydata/util/encryptor_spec.rb",
75
82
  "spec/flydata_spec.rb",
76
83
  "spec/spec_helper.rb",
@@ -79,7 +86,7 @@ Gem::Specification.new do |s|
79
86
  s.homepage = "http://flydata.co/"
80
87
  s.licenses = ["All right reserved."]
81
88
  s.require_paths = ["lib"]
82
- s.rubygems_version = "1.8.24"
89
+ s.rubygems_version = "1.8.23"
83
90
  s.summary = "FlyData CLI"
84
91
 
85
92
  if s.respond_to? :specification_version then
@@ -53,6 +53,13 @@ EOF
53
53
  start
54
54
  end
55
55
  end
56
+ def status
57
+ if process_exist?
58
+ say("Process is running.")
59
+ else
60
+ say("Process is not running.")
61
+ end
62
+ end
56
63
  def kill_all
57
64
  if system("ps ax | grep 'flydata' | grep -v grep | awk '{print \"kill \" $1}' | sh")
58
65
  say("Done.")
@@ -0,0 +1,10 @@
1
+ module Flydata
2
+ module Command
3
+ class Status < Base
4
+ def run
5
+ sender = Flydata::Command::Sender.new
6
+ sender.status
7
+ end
8
+ end
9
+ end
10
+ end
@@ -20,6 +20,7 @@ Usage: flydata COMMAND
20
20
  start # start flydata process
21
21
  stop # stop flydata process
22
22
  restart # restart flydata process
23
+ status # check flydata process
23
24
  conf # show configuration
24
25
  sync # initial sync(only for mysql database)
25
26
 
@@ -1,5 +1,5 @@
1
1
  module Flydata
2
- module Sync
2
+ module TableDef
3
3
 
4
4
  class MysqlTableDef
5
5
  TYPE_MAP_M2F = {
@@ -15,6 +15,7 @@ class MysqlTableDef
15
15
  'decimal' => 'numeric',
16
16
  'double' => 'float8',
17
17
  'double precision' => 'float8',
18
+ 'enum' => 'enum',
18
19
  'fixed' => 'numeric',
19
20
  'float' => 'float4',
20
21
  'int' => 'int4',
@@ -49,7 +50,6 @@ class MysqlTableDef
49
50
  end
50
51
 
51
52
  def self._create(io)
52
-
53
53
  table_def = ''
54
54
  table_name = nil
55
55
  columns = []
@@ -57,24 +57,88 @@ class MysqlTableDef
57
57
  comment = nil
58
58
 
59
59
  position = :before_create_table
60
+
60
61
  io.each_line do |line|
61
- if line =~ /CREATE TABLE `(.*?)`/
62
- position = :in_create_table
63
- table_name = $1
62
+ case position
63
+ when :before_create_table
64
+ if line =~ /CREATE TABLE `(.*?)`/
65
+ position = :in_create_table
66
+ table_name = $1
67
+ table_def += line.chomp
68
+ next
69
+ end
70
+
71
+ when :in_create_table
72
+ table_def += line.chomp
73
+
74
+ # `col_smallint` smallint(6) DEFAULT NULL,
75
+ if line.strip.start_with?('`')
76
+ columns << parse_column_line(line)
77
+ # PRIMARY KEY (`id`)
78
+ elsif line.strip.start_with?("PRIMARY KEY")
79
+ parse_primary_key(line, columns)
80
+ #) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='test table';
81
+ elsif line.strip.start_with?(')')
82
+ default_charset = $1 if line =~ /DEFAULT CHARSET\s*=\s*([^\s]+)/
83
+ comment = $1 if /COMMENT='((?:\\'|[^'])*)'/.match(line)
84
+ position = :after_create_table
85
+ else
86
+ raise "Invalid mysqldump file. It must be a bug...\n#{line}"
87
+ end
88
+
89
+ when :after_create_table
90
+ unless columns.any? {|column| column[:primary_key]}
91
+ raise "Primary key must be defined."
92
+ end
93
+ break
64
94
  end
95
+ end
96
+ position == :after_create_table ? [table_def, table_name, columns, default_charset, comment] : nil
97
+ end
98
+ attr_reader :columns, :table_name
99
+
100
+ def to_flydata_tabledef
101
+ tabledef = { table_name: @table_name,
102
+ columns: @columns,
103
+ }
104
+ tabledef[:default_charset] = @default_charset if @default_charset
105
+ tabledef[:comment] = @comment if @comment
65
106
 
66
- next unless position == :in_create_table
107
+ tabledef
108
+ end
67
109
 
68
- table_def += line.chomp
110
+ private
69
111
 
70
- if line =~ /^\s*`(.*?)`\s+([a-z()0-9,\s]+)/ # column def
71
- name = $1
72
- type = $2.strip
73
- type = type[0..-2] if type.end_with?(',')
112
+ def self.parse_column_line(line)
113
+ line = line.strip
114
+ line = line[0..-2] if line.end_with?(',')
115
+ pos = 0
116
+ cond = :column_name
117
+ column = {}
118
+
119
+ while pos < line.length
120
+ #cur_char = line[pos]
121
+ case cond
122
+ when :column_name #`column_name` ...
123
+ pos = line.index('`', 1)
124
+ column[:name] = line[1..pos-1]
125
+ cond = :column_type
126
+ pos += 1
127
+ when :column_type #... formattype(,,,) ...
128
+ pos += 1 until line[pos] != ' '
129
+ start_pos = pos
130
+ pos += 1 until line[pos].nil? || line[pos] =~ /\s|\(/
131
+ if line[pos] == '('
132
+ pos = parse_column_type_values(line, pos)
133
+ pos += 1
134
+ end
135
+ type = line[start_pos..pos-1]
74
136
  TYPE_MAP_M2F.each do |mysql_type, flydata_type|
75
137
  type.gsub!(/\b#{mysql_type}\b/, flydata_type)
76
138
  end
77
- column = {name: name, type: type}
139
+ column[:type] = type
140
+ cond = :options
141
+ when :options
78
142
  column[:auto_increment] = true if line =~ /AUTO_INCREMENT/
79
143
  column[:not_null] = true if line =~ /NOT NULL/
80
144
  if /DEFAULT\s+((?:[^'\s]+\b)|(?:'(?:\\'|[^'])*'))/.match(line)
@@ -86,41 +150,28 @@ class MysqlTableDef
86
150
  if /COMMENT\s+'(((?:\\'|[^'])*))'/.match(line)
87
151
  column[:comment] = $1
88
152
  end
89
- columns << column
90
- end
91
-
92
- if line =~ /PRIMARY KEY/
93
- primary_keys = line.scan(/`(.*?)`/).collect{|item| item[0]}
94
- primary_keys.each do |primary_key|
95
- column = columns.detect {|column|
96
- column[:name] === primary_key
97
- }
98
- raise "PK #{primary_key} must exist in the definition " if column.nil?
99
- column[:primary_key] = true
100
- end
101
- end
102
-
103
- if line =~ /DEFAULT CHARSET\s*=\s*([^\s]+)/
104
- default_charset = $1
105
- end
106
-
107
- if line =~ /ENGINE=.*/ # TODO Need better parsing.
108
- position = :after_create_table
109
153
  break
154
+ else
155
+ raise "Invalid condition. It must be a bug..."
110
156
  end
111
157
  end
112
- position == :after_create_table ? [table_def, table_name, columns, default_charset, comment] : nil
158
+ column
113
159
  end
114
- attr_reader :columns, :table_name
115
160
 
116
- def to_flydata_tabledef
117
- tabledef = { table_name: @table_name,
118
- columns: @columns,
119
- }
120
- tabledef[:default_charset] = @default_charset if @default_charset
121
- tabledef[:comment] = @comment if @comment
161
+ def self.parse_primary_key(line, columns)
162
+ primary_keys = line.scan(/`(.*?)`/).collect{|item| item[0]}
163
+ primary_keys.each do |primary_key|
164
+ column = columns.detect {|column|
165
+ column[:name] === primary_key
166
+ }
167
+ raise "PK #{primary_key} must exist in the definition " if column.nil?
168
+ column[:primary_key] = true
169
+ end
170
+ end
122
171
 
123
- tabledef
172
+ def self.parse_column_type_values(line, pos)
173
+ #TODO: more better parse
174
+ line.index(')', pos)
124
175
  end
125
176
  end
126
177
 
@@ -1,5 +1,5 @@
1
1
  module Flydata
2
- module Sync
2
+ module TableDef
3
3
 
4
4
  class RedshiftTableDef
5
5
  TYPE_MAP_F2R = {
@@ -7,6 +7,7 @@ class RedshiftTableDef
7
7
  'char' => {type: 'char', use_params: true},
8
8
  'date' => {type: 'date'},
9
9
  'datetime' => {type: 'timestamp'},
10
+ 'enum' => {type: 'varchar encode bytedict'},
10
11
  'float4' => {type: 'float4'},
11
12
  'float4 unsigned' => {type: 'float4'},
12
13
  'float8' => {type: 'float8'},
@@ -132,11 +133,15 @@ EOS
132
133
  sql = FLYDATA_CTL_COLUMNS_SQL % [ flydata_tabledef[:table_name] ]
133
134
  values = []
134
135
  flydata_tabledef[:columns].each do |col|
135
- values << "('#{flydata_tabledef[:table_name]}', '#{col[:name]}', '#{col[:type]}')"
136
+ values << "('#{flydata_tabledef[:table_name]}', '#{col[:name]}', '#{escape(col[:type])}')"
136
137
  end
137
138
  sql += values.join(",\n") + ';'
138
139
  sql
139
140
  end
141
+
142
+ def self.escape(text)
143
+ text.gsub("'", "\\\\'")
144
+ end
140
145
  end
141
146
 
142
147
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'fluent_plugins_spec_helper'
2
4
  require 'in_mysql_binlog_flydata'
3
5
  require 'timecop'
@@ -25,14 +27,32 @@ EOT
25
27
  # - 17 WRITE_ROWS_EVENT
26
28
  TEST_EVENT_INSERT=<<EOT
27
29
  {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>23, "server_id"=>1, "event_length"=>39, "next_position"=>667, "flags"=>1, "event_type"=>"Write_rows", "table_id"=>163, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[], "raw_used_columns"=>[255], "raw_row"=>[252, 3, 0, 0, 0, 3, 0, 102, 111, 111], "rows"=>[["1", "foo"],["2","var"],["3","hoge"]]}
30
+ EOT
31
+ TEST_EVENT_TWO_BYTE_INSERT=<<EOT
32
+ {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>23, "server_id"=>1, "event_length"=>39, "next_position"=>667, "flags"=>1, "event_type"=>"Write_rows", "table_id"=>163, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[], "raw_used_columns"=>[255], "raw_row"=>[252, 3, 0, 0, 0, 3, 0, 102, 111, 111], "rows"=>[["1", "føø"],["2","vår"],["3","høgé"]]}
33
+ EOT
34
+ TEST_EVENT_THREE_BYTE_INSERT=<<EOT
35
+ {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>23, "server_id"=>1, "event_length"=>39, "next_position"=>667, "flags"=>1, "event_type"=>"Write_rows", "table_id"=>163, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[], "raw_used_columns"=>[255], "raw_row"=>[252, 3, 0, 0, 0, 3, 0, 102, 111, 111], "rows"=>[["1", "富无无"],["2","易变的"],["3","切实切实"]]}
28
36
  EOT
29
37
  # - 18 UPDATE_ROWS_EVENT
30
38
  TEST_EVENT_UPDATE = <<EOT
31
39
  {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>24, "server_id"=>1, "event_length"=>78, "next_position"=>2606, "flags"=>1, "event_type"=>"Update_rows", "table_id"=>163, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[255], "raw_used_columns"=>[255], "raw_row"=>[252, 6, 0, 0, 0, 1, 0, 97, 252, 6, 0, 0, 0, 1, 0, 100, 252, 6, 0, 0, 0, 1, 0, 98, 252, 6, 0, 0, 0, 1, 0, 100, 252, 6, 0, 0, 0, 1, 0, 99, 252, 6, 0, 0, 0, 1, 0, 100], "rows"=>[[["1", "foo"], ["1", "wow"]],[["3", "hoge"], ["3", "fuga"]]]}
40
+ EOT
41
+ TEST_EVENT_TWO_BYTE_UPDATE = <<EOT
42
+ {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>24, "server_id"=>1, "event_length"=>78, "next_position"=>2606, "flags"=>1, "event_type"=>"Update_rows", "table_id"=>163, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[255], "raw_used_columns"=>[255], "raw_row"=>[252, 6, 0, 0, 0, 1, 0, 97, 252, 6, 0, 0, 0, 1, 0, 100, 252, 6, 0, 0, 0, 1, 0, 98, 252, 6, 0, 0, 0, 1, 0, 100, 252, 6, 0, 0, 0, 1, 0, 99, 252, 6, 0, 0, 0, 1, 0, 100], "rows"=>[[["1", "føø"], ["1", "∑ø∑"]],[["3", "høgé"], ["3", "fügå"]]]}
43
+ EOT
44
+ TEST_EVENT_THREE_BYTE_UPDATE = <<EOT
45
+ {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>24, "server_id"=>1, "event_length"=>78, "next_position"=>2606, "flags"=>1, "event_type"=>"Update_rows", "table_id"=>163, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[255], "raw_used_columns"=>[255], "raw_row"=>[252, 6, 0, 0, 0, 1, 0, 97, 252, 6, 0, 0, 0, 1, 0, 100, 252, 6, 0, 0, 0, 1, 0, 98, 252, 6, 0, 0, 0, 1, 0, 100, 252, 6, 0, 0, 0, 1, 0, 99, 252, 6, 0, 0, 0, 1, 0, 100], "rows"=>[[["1", "富无无"], ["1", "很兴奋"]],[["3", "切实切实"], ["3", "興奮虎"]]]}
32
46
  EOT
33
47
  # - 19 DELETE_ROWS_EVENT
34
48
  TEST_EVENT_DELETE = <<EOT
35
49
  {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>25, "server_id"=>1, "event_length"=>41, "next_position"=>5365, "flags"=>1, "event_type"=>"Delete_rows", "table_id"=>170, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[], "raw_used_columns"=>[255], "raw_row"=>[252, 2, 0, 0, 0, 5, 0, 104, 111, 104, 111, 103], "rows"=>[["2", "var"],["3","hoge"]]}
50
+ EOT
51
+ TEST_EVENT_TWO_BYTE_DELETE = <<EOT
52
+ {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>25, "server_id"=>1, "event_length"=>41, "next_position"=>5365, "flags"=>1, "event_type"=>"Delete_rows", "table_id"=>170, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[], "raw_used_columns"=>[255], "raw_row"=>[252, 2, 0, 0, 0, 5, 0, 104, 111, 104, 111, 103], "rows"=>[["2", "vår"],["3","høgé"]]}
53
+ EOT
54
+ TEST_EVENT_THREE_BYTE_DELETE = <<EOT
55
+ {"marker"=>0, "timestamp"=>#{TEST_TIMESTAMP}, "type_code"=>25, "server_id"=>1, "event_length"=>41, "next_position"=>5365, "flags"=>1, "event_type"=>"Delete_rows", "table_id"=>170, "db_name"=>"#{TEST_DB}", "table_name"=>"#{TEST_TABLE}", "columns"=>["LONG", "BLOB"], "columns_len"=>2, "null_bits_len"=>1, "raw_columns_before_image"=>[], "raw_used_columns"=>[255], "raw_row"=>[252, 2, 0, 0, 0, 5, 0, 104, 111, 104, 111, 103], "rows"=>[["2", "易变的"],["3","切实切实"]]}
36
56
  EOT
37
57
  # Unsupported event
38
58
  # - 02 QUERY_EVENT
@@ -120,8 +140,14 @@ EOT
120
140
 
121
141
  let(:plugin) { MysqlBinlogFlydataInput.new }
122
142
  let(:insert_event) { create_event(TEST_EVENT_INSERT) }
143
+ let(:insert_two_byte_event) { create_event(TEST_EVENT_TWO_BYTE_INSERT) }
144
+ let(:insert_three_byte_event) { create_event(TEST_EVENT_THREE_BYTE_INSERT) }
123
145
  let(:delete_event) { create_event(TEST_EVENT_DELETE) }
146
+ let(:delete_two_byte_event) { create_event(TEST_EVENT_TWO_BYTE_DELETE) }
147
+ let(:delete_three_byte_event) { create_event(TEST_EVENT_THREE_BYTE_DELETE) }
124
148
  let(:update_event) { create_event(TEST_EVENT_UPDATE) }
149
+ let(:update_two_byte_event) { create_event(TEST_EVENT_TWO_BYTE_UPDATE) }
150
+ let(:update_three_byte_event) { create_event(TEST_EVENT_THREE_BYTE_UPDATE) }
125
151
 
126
152
  let(:query_event) { create_event(TEST_EVENT_QUERY_CREATE_DATABSE) }
127
153
  let(:table_map_event) { create_event(TEST_EVENT_TABLE_MAP) }
@@ -160,6 +186,22 @@ EOT
160
186
  end
161
187
  end
162
188
 
189
+ context 'when received insert event containing two byte UTF8 chars' do
190
+ it do
191
+ table_seq_file.should_receive(:write).exactly(3).with(2)
192
+ expect_emitted_records_with_rows(insert_two_byte_event, :insert, TEST_TABLE,
193
+ [{"1"=>"0SL00000001", "2"=>"føø"}, {"1"=>"0SL00000002", "2"=>"vår"}, {"1"=>"0SL00000003", "2"=>"høgé"}])
194
+ end
195
+ end
196
+
197
+ context 'when received insert event containing three byte UTF8 chars' do
198
+ it do
199
+ table_seq_file.should_receive(:write).exactly(3).with(2)
200
+ expect_emitted_records_with_rows(insert_three_byte_event, :insert, TEST_TABLE,
201
+ [{"1"=>"0SL00000001", "2"=>"富无无"}, {"1"=>"0SL00000002", "2"=>"易变的"}, {"1"=>"0SL00000003", "2"=>"切实切实"}])
202
+ end
203
+ end
204
+
163
205
  context 'when received delete event' do
164
206
  it do
165
207
  table_seq_file.should_receive(:write).twice.with(2)
@@ -168,6 +210,22 @@ EOT
168
210
  end
169
211
  end
170
212
 
213
+ context 'when received delete event containing two byte UTF8 chars' do
214
+ it do
215
+ table_seq_file.should_receive(:write).twice.with(2)
216
+ expect_emitted_records_with_rows(delete_two_byte_event, :delete, TEST_TABLE,
217
+ [{"1"=>"0SL00000002", "2"=>"vår"}, {"1"=>"0SL00000003", "2"=>"høgé"}])
218
+ end
219
+ end
220
+
221
+ context 'when received delete event with containing byte UTF8 chars' do
222
+ it do
223
+ table_seq_file.should_receive(:write).twice.with(2)
224
+ expect_emitted_records_with_rows(delete_three_byte_event, :delete, TEST_TABLE,
225
+ [{"1"=>"0SL00000002", "2"=>"易变的"}, {"1"=>"0SL00000003", "2"=>"切实切实"}])
226
+ end
227
+ end
228
+
171
229
  context 'when received update event' do
172
230
  it do
173
231
  table_seq_file.should_receive(:write).twice.with(2)
@@ -176,6 +234,22 @@ EOT
176
234
  end
177
235
  end
178
236
 
237
+ context 'when received update event with two byte utf8 chars' do
238
+ it do
239
+ table_seq_file.should_receive(:write).twice.with(2)
240
+ expect_emitted_records_with_rows(update_two_byte_event, :update, TEST_TABLE,
241
+ [{"1"=>"0SL00000001", "2"=>"∑ø∑"}, {"1"=>"0SL00000003", "2"=>"fügå"}])
242
+ end
243
+ end
244
+
245
+ context 'when received update event with three byte utf8 chars' do
246
+ it do
247
+ table_seq_file.should_receive(:write).twice.with(2)
248
+ expect_emitted_records_with_rows(update_three_byte_event, :update, TEST_TABLE,
249
+ [{"1"=>"0SL00000001", "2"=>"很兴奋"}, {"1"=>"0SL00000003", "2"=>"興奮虎"}])
250
+ end
251
+ end
252
+
179
253
  context 'when received event with another database name' do
180
254
  it do
181
255
  event = insert_event
@@ -0,0 +1,123 @@
1
+ require 'spec_helper'
2
+ require 'flydata/table_def'
3
+
4
+ module Flydata
5
+ module TableDef
6
+
7
+
8
+ describe MysqlTableDef do
9
+
10
+ # file full path which exists in same directory.
11
+ def full_path(file_name)
12
+ File.join(File.dirname(__FILE__), file_name)
13
+ end
14
+
15
+ def file_io(file_name)
16
+ File.new(full_path(file_name))
17
+ end
18
+
19
+ describe '.to_flydata_tabledef' do
20
+ let(:dump_file_io) { raise "dump_file_io must be override on context." }
21
+ subject { MysqlTableDef.create(dump_file_io).to_flydata_tabledef }
22
+
23
+ context 'when dump file includes single table with all kind of format types' do
24
+ let(:dump_file_io) { file_io('mysqldump_test_table_all.dump') }
25
+
26
+ it 'should set correct table name' do
27
+ expect(subject[:table_name]).to eq('test_table_all')
28
+ end
29
+
30
+ it 'should set correct table name' do
31
+ expect(subject[:columns]).to eq(
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"},
36
+ {:name=>"col_bool", :type=>"int1(1)", :default=>"0"},
37
+ {:name=>"col_char", :type=>"varchar(6)", :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"},
47
+ {:name=>"col_longtext", :type=>"text"},
48
+ {:name=>"col_mediumblob", :type=>"varbinary"},
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"},
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(124)", :default=>nil}
60
+ ]
61
+ )
62
+ end
63
+
64
+ it 'default_charset should be set' do
65
+ expect(subject[:default_charset]).to eq('utf8')
66
+ end
67
+
68
+ it 'comment should be set' do
69
+ expect(subject[:comment]).to eq('test table includes all kind of format type')
70
+ end
71
+ end
72
+
73
+ context 'when table does not have primary key' do
74
+ let(:dump_file_io) { file_io('mysqldump_test_table_no_pk.dump') }
75
+ it 'should raise an error' do
76
+ expect{subject}.to raise_error('Primary key must be defined.')
77
+ end
78
+ end
79
+
80
+ context 'when column has comment' do
81
+ let(:dump_file_io) { file_io('mysqldump_test_table_column_comment.dump') }
82
+ it 'comment should be set' do
83
+ expect(subject[:columns]).to eq(
84
+ [
85
+ {:name=>"id", :type=>"int4(11)", :not_null=>true, :default=>"0",
86
+ :comment=>"this is primary key", :primary_key=>true},
87
+ {:name=>"value", :type=>"text"}
88
+ ]
89
+ )
90
+ end
91
+ end
92
+
93
+ context 'when table has multiple pk' do
94
+ let(:dump_file_io) { file_io('mysqldump_test_table_multi_pk.dump') }
95
+ it 'multi pk should be set' do
96
+ expect(subject[:columns]).to eq(
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"}
101
+ ]
102
+ )
103
+ end
104
+ end
105
+
106
+ context 'when table has enum column' do
107
+ let(:dump_file_io) { file_io('mysqldump_test_table_enum.dump') }
108
+ it 'enum columns should be parsed' do
109
+ expect(subject[:columns]).to eq(
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},
115
+ ]
116
+ )
117
+ end
118
+ end
119
+ end
120
+ end
121
+
122
+ end
123
+ end
@@ -0,0 +1,66 @@
1
+ -- MySQL dump 10.13 Distrib 5.6.13, for osx10.9 (x86_64)
2
+ --
3
+ -- Host: localhost Database: masashi_test
4
+ -- ------------------------------------------------------
5
+ -- Server version 5.6.13-log
6
+
7
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
+ /*!40101 SET NAMES utf8 */;
11
+ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
+ /*!40103 SET TIME_ZONE='+00:00' */;
13
+ /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
+
18
+ --
19
+ -- Table structure for table `test_table_all`
20
+ --
21
+
22
+ DROP TABLE IF EXISTS `test_table_all`;
23
+ /*!40101 SET @saved_cs_client = @@character_set_client */;
24
+ /*!40101 SET character_set_client = utf8 */;
25
+ CREATE TABLE `test_table_all` (
26
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
27
+ `col_binary` binary(100) DEFAULT NULL,
28
+ `col_blob` blob,
29
+ `col_bool` tinyint(1) DEFAULT '0',
30
+ `col_char` char(6) DEFAULT NULL,
31
+ `col_date` date DEFAULT NULL,
32
+ `col_datetime` datetime DEFAULT NULL,
33
+ `col_decimal` decimal(5,2) DEFAULT NULL,
34
+ `col_double` double DEFAULT NULL,
35
+ `col_float` float DEFAULT NULL,
36
+ `col_float_4_2` float(4,2) DEFAULT NULL,
37
+ `col_int` int(11) DEFAULT NULL,
38
+ `col_int_6` int(6) DEFAULT NULL,
39
+ `col_longblob` longblob,
40
+ `col_longtext` longtext,
41
+ `col_mediumblob` mediumblob,
42
+ `col_mediumint` mediumint(9) DEFAULT NULL,
43
+ `col_mediumtext` mediumtext,
44
+ `col_smallint` smallint(6) DEFAULT NULL,
45
+ `col_text` text,
46
+ `col_time` time DEFAULT NULL,
47
+ `col_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
48
+ `col_tinyblob` tinyblob,
49
+ `col_tinyint` tinyint(4) DEFAULT NULL,
50
+ `col_tinytext` tinytext,
51
+ `col_varbinary` varbinary(255) DEFAULT NULL,
52
+ `col_varchar` varchar(124) DEFAULT NULL,
53
+ PRIMARY KEY (`id`)
54
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='test table includes all kind of format type';
55
+ /*!40101 SET character_set_client = @saved_cs_client */;
56
+ /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
57
+
58
+ /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
59
+ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
60
+ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
61
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
62
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
63
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
64
+ /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
65
+
66
+ -- Dump completed on 2014-04-25 12:18:04
@@ -0,0 +1,41 @@
1
+ -- MySQL dump 10.13 Distrib 5.6.13, for osx10.9 (x86_64)
2
+ --
3
+ -- Host: localhost Database: masashi_test
4
+ -- ------------------------------------------------------
5
+ -- Server version 5.6.13-log
6
+
7
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
+ /*!40101 SET NAMES utf8 */;
11
+ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
+ /*!40103 SET TIME_ZONE='+00:00' */;
13
+ /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
+
18
+ --
19
+ -- Table structure for table `test_table_column_comment`
20
+ --
21
+
22
+ DROP TABLE IF EXISTS `test_table_column_comment`;
23
+ /*!40101 SET @saved_cs_client = @@character_set_client */;
24
+ /*!40101 SET character_set_client = utf8 */;
25
+ CREATE TABLE `test_table_column_comment` (
26
+ `id` int(11) NOT NULL DEFAULT '0' COMMENT 'this is primary key',
27
+ `value` text,
28
+ PRIMARY KEY (`id`)
29
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='column comment test';
30
+ /*!40101 SET character_set_client = @saved_cs_client */;
31
+ /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
32
+
33
+ /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
34
+ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
35
+ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
36
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
37
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
38
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
39
+ /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
40
+
41
+ -- Dump completed on 2014-04-25 13:24:35
@@ -0,0 +1,43 @@
1
+ -- MySQL dump 10.13 Distrib 5.6.13, for osx10.9 (x86_64)
2
+ --
3
+ -- Host: localhost Database: masashi_test
4
+ -- ------------------------------------------------------
5
+ -- Server version 5.6.13-log
6
+
7
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
+ /*!40101 SET NAMES utf8 */;
11
+ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
+ /*!40103 SET TIME_ZONE='+00:00' */;
13
+ /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
+
18
+ --
19
+ -- Table structure for table `test_table_enum`
20
+ --
21
+
22
+ DROP TABLE IF EXISTS `test_table_enum`;
23
+ /*!40101 SET @saved_cs_client = @@character_set_client */;
24
+ /*!40101 SET character_set_client = utf8 */;
25
+ CREATE TABLE `test_table_enum` (
26
+ `id` int(11) NOT NULL,
27
+ `enum_1` enum('apple','orange','banana') DEFAULT NULL,
28
+ `enum_2` enum('a','b','c') DEFAULT 'a',
29
+ `enum_3` enum('e','f','g') NOT NULL,
30
+ PRIMARY KEY (`id`)
31
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='with enum column';
32
+ /*!40101 SET character_set_client = @saved_cs_client */;
33
+ /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
34
+
35
+ /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
36
+ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
37
+ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
38
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
39
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
40
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
41
+ /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
42
+
43
+ -- Dump completed on 2014-04-25 13:55:12
@@ -0,0 +1,42 @@
1
+ -- MySQL dump 10.13 Distrib 5.6.13, for osx10.9 (x86_64)
2
+ --
3
+ -- Host: localhost Database: masashi_test
4
+ -- ------------------------------------------------------
5
+ -- Server version 5.6.13-log
6
+
7
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
+ /*!40101 SET NAMES utf8 */;
11
+ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
+ /*!40103 SET TIME_ZONE='+00:00' */;
13
+ /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
+
18
+ --
19
+ -- Table structure for table `test_table_multi_pk`
20
+ --
21
+
22
+ DROP TABLE IF EXISTS `test_table_multi_pk`;
23
+ /*!40101 SET @saved_cs_client = @@character_set_client */;
24
+ /*!40101 SET character_set_client = utf8 */;
25
+ CREATE TABLE `test_table_multi_pk` (
26
+ `id1` int(11) NOT NULL DEFAULT '0',
27
+ `id2` int(11) NOT NULL DEFAULT '0',
28
+ `value` text,
29
+ PRIMARY KEY (`id1`,`id2`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='multiple primary key';
31
+ /*!40101 SET character_set_client = @saved_cs_client */;
32
+ /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
33
+
34
+ /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
35
+ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
36
+ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
37
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
38
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
39
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
40
+ /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
41
+
42
+ -- Dump completed on 2014-04-25 13:39:30
@@ -0,0 +1,40 @@
1
+ -- MySQL dump 10.13 Distrib 5.6.13, for osx10.9 (x86_64)
2
+ --
3
+ -- Host: localhost Database: masashi_test
4
+ -- ------------------------------------------------------
5
+ -- Server version 5.6.13-log
6
+
7
+ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
+ /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
+ /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
+ /*!40101 SET NAMES utf8 */;
11
+ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
+ /*!40103 SET TIME_ZONE='+00:00' */;
13
+ /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
+
18
+ --
19
+ -- Table structure for table `test_table_no_pk`
20
+ --
21
+
22
+ DROP TABLE IF EXISTS `test_table_no_pk`;
23
+ /*!40101 SET @saved_cs_client = @@character_set_client */;
24
+ /*!40101 SET character_set_client = utf8 */;
25
+ CREATE TABLE `test_table_no_pk` (
26
+ `id` int(11) DEFAULT NULL,
27
+ `value` text
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='no primary key';
29
+ /*!40101 SET character_set_client = @saved_cs_client */;
30
+ /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
31
+
32
+ /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
33
+ /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
34
+ /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
35
+ /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
36
+ /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
37
+ /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
38
+ /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
39
+
40
+ -- Dump completed on 2014-04-25 13:48:49
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flydata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-18 00:00:00.000000000 Z
12
+ date: 2014-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -336,6 +336,7 @@ files:
336
336
  - lib/flydata/command/setlogdel.rb
337
337
  - lib/flydata/command/setup.rb
338
338
  - lib/flydata/command/start.rb
339
+ - lib/flydata/command/status.rb
339
340
  - lib/flydata/command/stop.rb
340
341
  - lib/flydata/command/sync.rb
341
342
  - lib/flydata/command/version.rb
@@ -364,6 +365,12 @@ files:
364
365
  - spec/flydata/command/sync_spec.rb
365
366
  - spec/flydata/fluent-plugins/in_mysql_binlog_flydata_spec.rb
366
367
  - spec/flydata/heroku_spec.rb
368
+ - spec/flydata/table_def/mysql_table_def_spec.rb
369
+ - spec/flydata/table_def/mysqldump_test_table_all.dump
370
+ - spec/flydata/table_def/mysqldump_test_table_column_comment.dump
371
+ - spec/flydata/table_def/mysqldump_test_table_enum.dump
372
+ - spec/flydata/table_def/mysqldump_test_table_multi_pk.dump
373
+ - spec/flydata/table_def/mysqldump_test_table_no_pk.dump
367
374
  - spec/flydata/util/encryptor_spec.rb
368
375
  - spec/flydata_spec.rb
369
376
  - spec/spec_helper.rb
@@ -383,7 +390,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
383
390
  version: '0'
384
391
  segments:
385
392
  - 0
386
- hash: 1795094757284592242
393
+ hash: -2999852327908013183
387
394
  required_rubygems_version: !ruby/object:Gem::Requirement
388
395
  none: false
389
396
  requirements:
@@ -392,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
392
399
  version: '0'
393
400
  requirements: []
394
401
  rubyforge_project:
395
- rubygems_version: 1.8.24
402
+ rubygems_version: 1.8.23
396
403
  signing_key:
397
404
  specification_version: 3
398
405
  summary: FlyData CLI