migration_bundler 1.3.0 → 1.3.1

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: 436ba30d0763b80697d248108f716c97cc03c15d
4
- data.tar.gz: d0d9e4137171423a8e3a216352b81c47f046ada3
3
+ metadata.gz: 8ec2212098914eb16d0ed82047ec6de592166204
4
+ data.tar.gz: 6f8c7c07c7f1246e2581c61bebd08f720936db90
5
5
  SHA512:
6
- metadata.gz: be3ce97159429c2f69e91ccef63593f461416dd3e6a011efdba77c895b56546dfda8fa4695edb58b5e0d1587a975836734063cc5f8de511c4a66f8e5a7ce60c8
7
- data.tar.gz: 887a650861bd675b88f74537c72984ef251115b8cf8d4241e8691c0ca0739f6ee6799f906dc289dcd79d48211bc5d5d8a252da00feb26c266d10948a48d8e565
6
+ metadata.gz: 01739a8ad7e9b04285d94b4bc32b4bbb7ab08063dc98b646af49726b6cc266efbe1f099e6eec4e17539dd3fb61e81f5d819221c90fe93722f582ca049e86a35f
7
+ data.tar.gz: 4a5702c94dc8e7b4b9d7a5880664f5d4d3638e2e4aeff2993ebe65f83179822892923e71f4b9bc88deace058c4ff6c624ca35a269e1531fc37bd99fcb3036cde
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v1.3.1
2
+
3
+ * Enhanced support for dumping Cassandra columns.
4
+
1
5
  ## v1.3.0
2
6
 
3
7
  * Added support for dumping arbitrary sets of tables.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- migration_bundler (1.3.0)
4
+ migration_bundler (1.3.1)
5
5
  cql-rb (~> 2.0.0)
6
6
  sqlite3 (~> 1.3.9)
7
7
  thor (~> 0.19.1)
@@ -48,7 +48,7 @@ GEM
48
48
  coderay (1.1.0)
49
49
  colored (1.2)
50
50
  columnize (0.8.9)
51
- cql-rb (2.0.0)
51
+ cql-rb (2.0.1)
52
52
  ione (~> 1)
53
53
  debugger-linecache (1.2.0)
54
54
  diff-lcs (1.2.5)
@@ -67,7 +67,7 @@ GEM
67
67
  guard (~> 2.1)
68
68
  rspec (>= 2.14, < 4.0)
69
69
  i18n (0.6.9)
70
- ione (1.1.2)
70
+ ione (1.1.3)
71
71
  json_pure (1.8.1)
72
72
  listen (2.7.7)
73
73
  celluloid (>= 0.15.2)
@@ -77,12 +77,34 @@ module MigrationBundler
77
77
  rows.each do |row|
78
78
  values = columns.map do |column|
79
79
  value = row[column]
80
- value.is_a?(String) ? "\"#{value}\"" : value
80
+ serialize_value_of_type(value, rows.metadata[column].type)
81
81
  end
82
82
  statements << "INSERT INTO #{table_name} (#{columns.join(', ')}) VALUES (#{values.join(', ')});"
83
83
  end
84
84
  end
85
85
  end
86
+
87
+ def serialize_value_of_type(value, type)
88
+ if type.is_a?(Array) && type.first == :list
89
+ '[' + serialize_value_of_type(value, type.last) + ']'
90
+ elsif type.is_a?(Array) && type.first == :set
91
+ '{' + serialize_value_of_type(value, type.last) + '}'
92
+ elsif value.kind_of?(Enumerable)
93
+ value.map { |e| serialize_value_of_type(e, type) }.join(', ')
94
+ else
95
+ if type == :blob
96
+ '0x' + value.unpack('H*').first
97
+ else
98
+ case value
99
+ when String then "'#{value}'"
100
+ when Cql::TimeUuid then value.to_s
101
+ when NilClass then 'NULL'
102
+ else
103
+ value
104
+ end
105
+ end
106
+ end
107
+ end
86
108
  end
87
109
  end
88
110
  end
@@ -1,3 +1,3 @@
1
1
  module MigrationBundler
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
@@ -5,7 +5,7 @@ require 'migration_bundler/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'migration_bundler'
8
- s.version = '1.3.0'
8
+ s.version = '1.3.1'
9
9
  s.date = '2014-06-26'
10
10
  s.summary = "A flexible database schema management system."
11
11
  s.description = "Migration Bundler is a complete database schema management system providing migrations, dump/load, and packaging of schema artifacts."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migration_bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Watters
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.0.14
237
+ rubygems_version: 2.3.0
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: A flexible database schema management system.