masamune 0.17.13 → 0.17.14

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: 211a98d1efc9791eeceb07e89df0c2ad70c27a4a
4
- data.tar.gz: 2a7240f993c7a1252f75f009be836b5b6b5bdd32
3
+ metadata.gz: 12cda9508ecb50bf13f5750d645fe67718e51264
4
+ data.tar.gz: 8d285ef8dfc9370d650852f8063d1925aed943f4
5
5
  SHA512:
6
- metadata.gz: 91022241697047ed01744ef834602314e35b90144c50d84699d4c21ab3403f4333188c7a340fac00a90433f92fe382654a852d7817cc43fd0942f5e7ef24f1a7
7
- data.tar.gz: 13b3a769d6edf9efa8b50e6a982b59c3d0241c9a38558700e6938a30748aea1953c8b83e6a1ea834141446b5557e8886bb2681b5ae7bfdfeb98d3d3c59465449
6
+ metadata.gz: 23a73a59ba63fac580fe66238d760b5097c662d412f06474f2c3916244639e9a8a9dbadf124d7e45b38aa115763151b32fcff73e65fdb9dee446a323d09a57fd
7
+ data.tar.gz: 34dd1c01933b0a7809fb3101007dcf56d729d197039a77e6275cc67d8e51b3286913826b06ed3cc1087ee0a3b15f3286fa3101f0aebbfa876151b10df3138905
@@ -74,7 +74,8 @@ module Masamune::Helpers
74
74
  def update_table_last_modified_at(table, column)
75
75
  return if @cache[table].present?
76
76
  postgres(exec: "SELECT MAX(#{column}) FROM #{table};", tuple_output: true, retries: 0) do |line|
77
- @cache[table] = parse_date_time(line.strip)
77
+ last_modified_at = line.strip
78
+ @cache[table] = parse_date_time(last_modified_at) unless last_modified_at.blank?
78
79
  end
79
80
  end
80
81
 
@@ -24,9 +24,6 @@ SELECT pg_advisory_lock(<%= target.lock_id %>);
24
24
 
25
25
  BEGIN;
26
26
 
27
- <%-# Relabel version column -%>
28
- UPDATE <%= target.name %> SET version = NULL;
29
-
30
27
  UPDATE
31
28
  <%= target.name %>
32
29
  SET
@@ -42,16 +39,11 @@ FROM
42
39
  rank() OVER (PARTITION BY <%= target.window.join(', ') %> ORDER BY start_at) AS version
43
40
  FROM
44
41
  <%= target.name %>
45
- GROUP BY
46
- <%= target.window(:id, :start_at).join(', ') %>
47
42
  ) AS tmp
48
43
  WHERE
49
44
  <%= target.name %>.id = tmp.id
50
45
  ;
51
46
 
52
- <%-# Relabel end_at column -%>
53
- UPDATE <%= target.name %> SET end_at = NULL;
54
-
55
47
  UPDATE
56
48
  <%= target.name %>
57
49
  SET
@@ -67,8 +59,6 @@ FROM
67
59
  LEAD(start_at, 1) OVER (PARTITION BY <%= target.window.join(', ') %> ORDER BY start_at) AS end_at
68
60
  FROM
69
61
  <%= target.name %>
70
- GROUP BY
71
- <%= target.window(:id, :start_at).join(', ') %>
72
62
  ) AS tmp
73
63
  WHERE
74
64
  <%= target.name %>.id = tmp.id
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.17.13'.freeze
24
+ VERSION = '0.17.14'.freeze
25
25
  end
@@ -74,7 +74,7 @@ describe Masamune::Helpers::Postgres do
74
74
  context 'with last_modified_at option' do
75
75
  before do
76
76
  expect(instance).to receive(:table_exists?).and_return(true)
77
- expect(instance).to receive(:postgres).with(hash_including(exec: 'SELECT MAX(last_modified_at) FROM foo;', tuple_output: true, retries: 0)).and_yield(output)
77
+ expect(instance).to receive(:postgres).with(hash_including(exec: 'SELECT MAX(last_modified_at) FROM foo;', tuple_output: true, retries: 0)).and_yield(output).and_yield('')
78
78
  end
79
79
 
80
80
  let(:options) { { last_modified_at: 'last_modified_at' } }
@@ -50,8 +50,6 @@ describe Masamune::Transform::RelabelDimension do
50
50
 
51
51
  BEGIN;
52
52
 
53
- UPDATE user_dimension SET version = NULL;
54
-
55
53
  UPDATE
56
54
  user_dimension
57
55
  SET
@@ -66,15 +64,11 @@ describe Masamune::Transform::RelabelDimension do
66
64
  rank() OVER (PARTITION BY tenant_id, user_id ORDER BY start_at) AS version
67
65
  FROM
68
66
  user_dimension
69
- GROUP BY
70
- id, tenant_id, user_id, start_at
71
67
  ) AS tmp
72
68
  WHERE
73
69
  user_dimension.id = tmp.id
74
70
  ;
75
71
 
76
- UPDATE user_dimension SET end_at = NULL;
77
-
78
72
  UPDATE
79
73
  user_dimension
80
74
  SET
@@ -89,8 +83,6 @@ describe Masamune::Transform::RelabelDimension do
89
83
  LEAD(start_at, 1) OVER (PARTITION BY tenant_id, user_id ORDER BY start_at) AS end_at
90
84
  FROM
91
85
  user_dimension
92
- GROUP BY
93
- id, tenant_id, user_id, start_at
94
86
  ) AS tmp
95
87
  WHERE
96
88
  user_dimension.id = tmp.id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masamune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.13
4
+ version: 0.17.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andrews
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-20 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor