bigquery_migration 0.1.6 → 0.1.7

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: ce47a4ba011b85511ddfcdb55489abd8bddebdb4
4
- data.tar.gz: 2c22d84df63cc2a0000fb05f07f062332528cfb7
3
+ metadata.gz: c113ced051e1bf7c9b8a78123b56e06cb750251f
4
+ data.tar.gz: 3d9f5f9c8ea1af31753b7ea92eb77a8a8a612ef5
5
5
  SHA512:
6
- metadata.gz: af8b65b3735dff7e674528121dd145b1b14b346a58b3928e16375f4bbd0bb757d7ecb370fa8efd6a65aafd7f625fde5ede18b1f2533551c8a34dd0db5d077809
7
- data.tar.gz: 4bad1538699ecdee97efa129bf8bd7900fb8cd3913c5363b134b6c10d8b6a2ed02423d089944fc67c115b72d677f111b9016d532890d59e78b6f2119f793df05
6
+ metadata.gz: d98d9fac6a2466fba7bddadf38fedccf11829782c549bf7b2ac3709bf7836fc42725cdd385e34c3cf56da262501d35315f4cd516a826309ff5b2b2236a47ca65
7
+ data.tar.gz: a9e14ad54d9144d6414af8d0c09922821905dbde2738dfec1eb5fd17a9c67a403b970e4ca8b46b193cd9aea9be3650ff8082cefb4a9d9ef417dec87fe69db7d9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.1.7 (2016/09/16)
2
+
3
+ Fixes:
4
+
5
+ * migrate_table should create table only if a table does not exist
6
+
7
+ Enhancements:
8
+
9
+ * create_table should not create a table with empty columns
10
+
1
11
  # 0.1.6 (2016/07/26)
2
12
 
3
13
  Fixes:
@@ -202,6 +202,7 @@ class BigqueryMigration
202
202
  def insert_table(dataset: nil, table: nil, columns: )
203
203
  dataset ||= self.dataset
204
204
  table ||= self.table
205
+ raise Error, "columns is empty" if columns.empty?
205
206
  schema = Schema.new(columns)
206
207
 
207
208
  begin
@@ -655,12 +656,14 @@ class BigqueryMigration
655
656
  end
656
657
  Schema.validate_columns!(columns)
657
658
 
658
- before_columns = existing_columns
659
-
660
659
  result = {}
661
- if before_columns.empty?
660
+ begin
661
+ get_table
662
+ rescue NotFoundError
663
+ before_columns = []
662
664
  result = create_table(table: table, columns: columns)
663
665
  else
666
+ before_columns = existing_columns
664
667
  add_columns = Schema.diff_columns(before_columns, columns)
665
668
  drop_columns = Schema.diff_columns(columns, before_columns)
666
669
 
@@ -1,3 +1,3 @@
1
1
  class BigqueryMigration
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigquery_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-26 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client