masamune 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/masamune/schema/table.rb +7 -2
- data/lib/masamune/transform/bulk_upsert.psql.erb +2 -0
- data/lib/masamune/transform/define_schema.psql.erb +5 -0
- data/lib/masamune/transform/define_table.psql.erb +4 -0
- data/lib/masamune/transform/insert_reference_values.psql.erb +2 -0
- data/lib/masamune/transform/rollup_fact.psql.erb +37 -17
- data/lib/masamune/transform/stage_dimension.psql.erb +2 -0
- data/lib/masamune/transform/stage_fact.psql.erb +35 -19
- data/lib/masamune/version.rb +1 -1
- data/spec/masamune/transform/bulk_upsert.dimension_spec.rb +4 -0
- data/spec/masamune/transform/define_table.fact_spec.rb +2 -0
- data/spec/masamune/transform/define_table.table_spec.rb +4 -0
- data/spec/masamune/transform/insert_reference_values.dimension_spec.rb +4 -0
- data/spec/masamune/transform/insert_reference_values.fact_spec.rb +8 -0
- data/spec/masamune/transform/rollup_fact_spec.rb +157 -106
- data/spec/masamune/transform/stage_dimension_spec.rb +2 -0
- data/spec/masamune/transform/stage_fact_spec.rb +60 -43
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fa78c46b273926ab7d772334d589a4376532612
|
4
|
+
data.tar.gz: c95f3122a4c62bd3fa65f1f0bf4b16287917553e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c61a1654730091053886326dce2a53b313df2041040e5dba0c54c5699c39927eae80299bf4b50333ad1a700a8322144310c6fdb65d6022ab51a26b7cfee0e4a
|
7
|
+
data.tar.gz: baba5a9769d75196fcf35442084326e0d0c27ab22b71aaf2c4e31826c03953ea23c4b8e9e9af6b4234d0ef8910c22bb8783275405d09d173e6f617867ee3c193
|
@@ -120,7 +120,7 @@ module Masamune::Schema
|
|
120
120
|
return [] if temporary?
|
121
121
|
unique_constraints_map.map do |_, column_names|
|
122
122
|
[column_names, short_md5(column_names)]
|
123
|
-
end
|
123
|
+
end.uniq
|
124
124
|
end
|
125
125
|
|
126
126
|
# TODO: Add optional USING
|
@@ -129,7 +129,7 @@ module Masamune::Schema
|
|
129
129
|
index_column_map.map do |_, column_names|
|
130
130
|
unique_index = reverse_unique_constraints_map.key?(column_names.sort)
|
131
131
|
[column_names, unique_index, short_md5(column_names)]
|
132
|
-
end
|
132
|
+
end.uniq
|
133
133
|
end
|
134
134
|
|
135
135
|
def unique_columns
|
@@ -242,6 +242,11 @@ module Masamune::Schema
|
|
242
242
|
inherit ? parent.reserved_column_ids : []
|
243
243
|
end
|
244
244
|
|
245
|
+
# NOTE: postgres bigint is 8 bytes long
|
246
|
+
def lock_id
|
247
|
+
Integer('0x' + Digest::MD5.hexdigest(name)) % (1 << 63)
|
248
|
+
end
|
249
|
+
|
245
250
|
private
|
246
251
|
|
247
252
|
def stage_table_columns(parent, selected = [], inherit = true)
|
@@ -78,6 +78,10 @@ SELECT <%= row.insert_values.join(', ') %>
|
|
78
78
|
WHERE NOT EXISTS (SELECT 1 FROM <%= target.name %> WHERE <%= row.insert_constraints.join(' AND ') %>);
|
79
79
|
<%- end -%>
|
80
80
|
|
81
|
+
<%- if files.any? || target.insert_rows.any? -%>
|
82
|
+
ANALYZE <%= target.name %>;
|
83
|
+
<%- end -%>
|
84
|
+
|
81
85
|
<% target.aliased_rows.each do |row| %>
|
82
86
|
<%- row.natural_keys.each do |column| -%>
|
83
87
|
CREATE OR REPLACE FUNCTION <%= row.name(column) %>
|
@@ -20,15 +20,15 @@
|
|
20
20
|
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
-- THE SOFTWARE.
|
22
22
|
|
23
|
-
<%- target_stage = target.stage_table
|
23
|
+
<%- target_stage = target.stage_table %>
|
24
|
+
|
25
|
+
SELECT pg_advisory_lock(<%= target_stage.lock_id %>);
|
24
26
|
|
25
27
|
DROP TABLE IF EXISTS <%= target_stage.name %> CASCADE;
|
26
|
-
|
28
|
+
DROP TABLE IF EXISTS <%= target_stage.name %>_tmp CASCADE;
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
ALTER TABLE <%= target_stage.name %> ADD CONSTRAINT <%= target_stage.name %>_<%= column.name %>_fkey FOREIGN KEY (<%= column.name %>) <%= column.reference_constraint %>;
|
31
|
-
<%- end -%>
|
30
|
+
CREATE TABLE IF NOT EXISTS <%= target.name %> (LIKE <%= target.parent.name %> INCLUDING ALL);
|
31
|
+
CREATE TABLE IF NOT EXISTS <%= target_stage.name %> (LIKE <%= target.parent.name %> INCLUDING ALL);
|
32
32
|
|
33
33
|
INSERT INTO
|
34
34
|
<%= target_stage.name %> (<%= target.insert_columns(source).join(', ') %>)
|
@@ -50,26 +50,46 @@ GROUP BY
|
|
50
50
|
<%- end -%>
|
51
51
|
;
|
52
52
|
|
53
|
-
|
54
|
-
<%- index_name = "#{target_stage.name}_#{column_names.join('_')}_index" -%>
|
55
|
-
CREATE <%= unique ? 'UNIQUE INDEX' : 'INDEX' %> <%= index_name %> ON <%= target_stage.name %> (<%= column_names.join(', ') %>);
|
56
|
-
<%- end -%>
|
53
|
+
SELECT pg_advisory_lock(ddl_advisory_lock());
|
57
54
|
|
58
55
|
BEGIN;
|
56
|
+
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
57
|
+
|
58
|
+
ALTER TABLE <%= target.name %> DROP CONSTRAINT IF EXISTS <%= target.name %>_time_key_check;
|
59
|
+
<%- target.foreign_key_columns.each do |column| -%>
|
60
|
+
<%- if column.reference_constraint -%>
|
61
|
+
ALTER TABLE <%= target.name %> DROP CONSTRAINT IF EXISTS <%= target.name %>_<%= column.name %>_fkey CASCADE;
|
62
|
+
<%- end -%>
|
63
|
+
<%- end -%>
|
64
|
+
|
65
|
+
<%- target.index_columns.each do |column_names, unique, id| -%>
|
66
|
+
<%- index_name = "#{target.name}_#{id}_index" -%>
|
67
|
+
DROP INDEX IF EXISTS <%= index_name %>;
|
68
|
+
<%- end -%>
|
59
69
|
|
60
|
-
|
70
|
+
ALTER TABLE <%= target.name %> RENAME TO <%= target_stage.name %>_tmp;
|
61
71
|
ALTER TABLE <%= target_stage.name %> RENAME TO <%= target.name %>;
|
62
72
|
|
63
73
|
ALTER TABLE <%= target.name %> INHERIT <%= target.parent.name %>;
|
64
|
-
ALTER TABLE <%= target.name %> ADD CONSTRAINT <%= target.name %>_time_key_check <%= target.constraints
|
74
|
+
ALTER TABLE <%= target.name %> ADD CONSTRAINT <%= target.name %>_time_key_check <%= target.constraints %>;
|
65
75
|
<%- target.foreign_key_columns.each do |column| -%>
|
66
|
-
|
76
|
+
<%- if column.reference_constraint -%>
|
77
|
+
ALTER TABLE <%= target.name %> ADD CONSTRAINT <%= target.name %>_<%= column.name %>_fkey FOREIGN KEY (<%= column.name %>) <%= column.reference_constraint %> NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
78
|
+
<%- end -%>
|
67
79
|
<%- end -%>
|
68
80
|
|
69
|
-
<%- target.index_columns.each do |column_names, unique| -%>
|
70
|
-
<%-
|
71
|
-
|
72
|
-
ALTER INDEX <%= old_index_name %> RENAME TO <%= new_index_name %>;
|
81
|
+
<%- target.index_columns.each do |column_names, unique, id| -%>
|
82
|
+
<%- index_name = "#{target.name}_#{id}_index" -%>
|
83
|
+
CREATE <%= unique ? 'UNIQUE INDEX' : 'INDEX' %> <%= index_name %> ON <%= target.name %> (<%= column_names.join(', ') %>);
|
73
84
|
<%- end -%>
|
74
85
|
|
86
|
+
ANALYZE <%= target.name %>;
|
87
|
+
|
75
88
|
COMMIT;
|
89
|
+
|
90
|
+
DROP TABLE IF EXISTS <%= target_stage.name %>_tmp CASCADE;
|
91
|
+
DROP TABLE IF EXISTS <%= target_stage.name %> CASCADE;
|
92
|
+
|
93
|
+
SELECT pg_advisory_unlock(ddl_advisory_lock());
|
94
|
+
|
95
|
+
SELECT pg_advisory_unlock(<%= target_stage.lock_id %>);
|
@@ -21,17 +21,15 @@
|
|
21
21
|
-- THE SOFTWARE.
|
22
22
|
|
23
23
|
<%- target_partition = target.partition_table(date) %>
|
24
|
-
<%- target_stage = target_partition.stage_table
|
24
|
+
<%- target_stage = target_partition.stage_table %>
|
25
|
+
|
26
|
+
SELECT pg_advisory_lock(<%= target_partition.lock_id %>);
|
25
27
|
|
26
28
|
DROP TABLE IF EXISTS <%= target_stage.name %> CASCADE;
|
27
|
-
|
29
|
+
DROP TABLE IF EXISTS <%= target_partition.name %>_tmp CASCADE;
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
<%- if column.reference_constraint -%>
|
32
|
-
ALTER TABLE <%= target_stage.name %> ADD CONSTRAINT <%= target_stage.name %>_<%= column.name %>_fkey FOREIGN KEY (<%= column.name %>) <%= column.reference_constraint %>;
|
33
|
-
<%- end -%>
|
34
|
-
<%- end -%>
|
31
|
+
CREATE TABLE IF NOT EXISTS <%= target_stage.name %> (LIKE <%= target.name %> INCLUDING ALL);
|
32
|
+
CREATE TABLE IF NOT EXISTS <%= target_partition.name %> (LIKE <%= target.name %> INCLUDING ALL);
|
35
33
|
|
36
34
|
INSERT INTO
|
37
35
|
<%= target_stage.name %> (<%= target.insert_columns(source).join(', ') %>)
|
@@ -49,28 +47,46 @@ ON
|
|
49
47
|
<%- end -%>
|
50
48
|
;
|
51
49
|
|
52
|
-
|
53
|
-
<%- index_name = "#{target_stage.name}_#{column_names.join('_')}_index" -%>
|
54
|
-
CREATE <%= unique ? 'UNIQUE INDEX' : 'INDEX' %> <%= index_name %> ON <%= target_stage.name %> (<%= column_names.join(', ') %>);
|
55
|
-
<%- end -%>
|
50
|
+
SELECT pg_advisory_lock(ddl_advisory_lock());
|
56
51
|
|
57
52
|
BEGIN;
|
53
|
+
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
54
|
+
|
55
|
+
ALTER TABLE <%= target_partition.name %> DROP CONSTRAINT IF EXISTS <%= target_partition.name %>_time_key_check;
|
56
|
+
<%- target.foreign_key_columns.each do |column| -%>
|
57
|
+
<%- if column.reference_constraint -%>
|
58
|
+
ALTER TABLE <%= target_partition.name %> DROP CONSTRAINT IF EXISTS <%= target_partition.name %>_<%= column.name %>_fkey CASCADE;
|
59
|
+
<%- end -%>
|
60
|
+
<%- end -%>
|
61
|
+
|
62
|
+
<%- target_partition.index_columns.each do |column_names, unique, id| -%>
|
63
|
+
<%- index_name = "#{target_partition.name}_#{id}_index" -%>
|
64
|
+
DROP INDEX IF EXISTS <%= index_name %>;
|
65
|
+
<%- end -%>
|
58
66
|
|
59
|
-
|
67
|
+
ALTER TABLE <%= target_partition.name %> RENAME TO <%= target_partition.name %>_tmp;
|
60
68
|
ALTER TABLE <%= target_stage.name %> RENAME TO <%= target_partition.name %>;
|
61
69
|
|
62
70
|
ALTER TABLE <%= target_partition.name %> INHERIT <%= target.name %>;
|
63
|
-
ALTER TABLE <%= target_partition.name %> ADD CONSTRAINT <%= target_partition.name %>_time_key_check <%= target_partition.constraints
|
71
|
+
ALTER TABLE <%= target_partition.name %> ADD CONSTRAINT <%= target_partition.name %>_time_key_check <%= target_partition.constraints %>;
|
64
72
|
<%- target.foreign_key_columns.each do |column| -%>
|
65
73
|
<%- if column.reference_constraint -%>
|
66
|
-
ALTER TABLE <%= target_partition.name %> ADD CONSTRAINT <%= target_partition.name %>_<%= column.name %>_fkey FOREIGN KEY (<%= column.name %>) <%= column.reference_constraint %> NOT VALID;
|
74
|
+
ALTER TABLE <%= target_partition.name %> ADD CONSTRAINT <%= target_partition.name %>_<%= column.name %>_fkey FOREIGN KEY (<%= column.name %>) <%= column.reference_constraint %> NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
67
75
|
<%- end -%>
|
68
76
|
<%- end -%>
|
69
77
|
|
70
|
-
<%-
|
71
|
-
<%-
|
72
|
-
|
73
|
-
ALTER INDEX <%= old_index_name %> RENAME TO <%= new_index_name %>;
|
78
|
+
<%- target_partition.index_columns.each do |column_names, unique, id| -%>
|
79
|
+
<%- index_name = "#{target_partition.name}_#{id}_index" -%>
|
80
|
+
CREATE <%= unique ? 'UNIQUE INDEX' : 'INDEX' %> <%= index_name %> ON <%= target_partition.name %> (<%= column_names.join(', ') %>);
|
74
81
|
<%- end -%>
|
75
82
|
|
83
|
+
ANALYZE <%= target_partition.name %>;
|
84
|
+
|
76
85
|
COMMIT;
|
86
|
+
|
87
|
+
DROP TABLE IF EXISTS <%= target_partition.name %>_tmp CASCADE;
|
88
|
+
DROP TABLE IF EXISTS <%= target_stage.name %> CASCADE;
|
89
|
+
|
90
|
+
SELECT pg_advisory_unlock(ddl_advisory_lock());
|
91
|
+
|
92
|
+
SELECT pg_advisory_unlock(<%= target_partition.lock_id %>);
|
data/lib/masamune/version.rb
CHANGED
@@ -127,6 +127,8 @@ describe Masamune::Transform::BulkUpsert do
|
|
127
127
|
user_dimension.start_at IS NULL
|
128
128
|
;
|
129
129
|
|
130
|
+
ANALYZE user_dimension;
|
131
|
+
|
130
132
|
COMMIT;
|
131
133
|
EOS
|
132
134
|
end
|
@@ -191,6 +193,8 @@ describe Masamune::Transform::BulkUpsert do
|
|
191
193
|
user_dimension_ledger.start_at IS NULL
|
192
194
|
;
|
193
195
|
|
196
|
+
ANALYZE user_dimension_ledger;
|
197
|
+
|
194
198
|
COMMIT;
|
195
199
|
EOS
|
196
200
|
end
|
@@ -212,6 +212,8 @@ describe Masamune::Transform::DefineTable do
|
|
212
212
|
CREATE INDEX visits_file_fact_stage_d5d236f_index ON visits_file_fact_stage (user_agent_type_version);
|
213
213
|
CREATE INDEX visits_file_fact_stage_5a187ed_index ON visits_file_fact_stage (feature_type_name);
|
214
214
|
CREATE INDEX visits_file_fact_stage_6444ed3_index ON visits_file_fact_stage (time_key);
|
215
|
+
|
216
|
+
ANALYZE visits_file_fact_stage;
|
215
217
|
EOS
|
216
218
|
end
|
217
219
|
|
@@ -240,6 +240,8 @@ describe Masamune::Transform::DefineTable do
|
|
240
240
|
INSERT INTO user_table (name)
|
241
241
|
SELECT 'active'
|
242
242
|
WHERE NOT EXISTS (SELECT 1 FROM user_table WHERE name = 'active');
|
243
|
+
|
244
|
+
ANALYZE user_table;
|
243
245
|
EOS
|
244
246
|
end
|
245
247
|
end
|
@@ -314,6 +316,8 @@ describe Masamune::Transform::DefineTable do
|
|
314
316
|
SELECT default_tenant_id(), -2
|
315
317
|
WHERE NOT EXISTS (SELECT 1 FROM user_table WHERE tenant_id = default_tenant_id() AND user_id = -2);
|
316
318
|
|
319
|
+
ANALYZE user_table;
|
320
|
+
|
317
321
|
CREATE OR REPLACE FUNCTION default_user_id()
|
318
322
|
RETURNS INTEGER IMMUTABLE AS $$
|
319
323
|
SELECT -1;
|
@@ -74,6 +74,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
74
74
|
department_type_department_id IS NOT NULL
|
75
75
|
;
|
76
76
|
|
77
|
+
ANALYZE department_type_stage;
|
78
|
+
|
77
79
|
BEGIN;
|
78
80
|
LOCK TABLE department_type IN EXCLUSIVE MODE;
|
79
81
|
|
@@ -94,6 +96,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
94
96
|
department_type.department_id IS NULL
|
95
97
|
;
|
96
98
|
|
99
|
+
ANALYZE department_type;
|
100
|
+
|
97
101
|
COMMIT;
|
98
102
|
EOS
|
99
103
|
end
|
@@ -91,6 +91,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
91
91
|
user_agent_type_name IS NOT NULL
|
92
92
|
;
|
93
93
|
|
94
|
+
ANALYZE user_agent_type_stage;
|
95
|
+
|
94
96
|
BEGIN;
|
95
97
|
LOCK TABLE user_agent_type IN EXCLUSIVE MODE;
|
96
98
|
|
@@ -111,6 +113,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
111
113
|
user_agent_type.version IS NULL
|
112
114
|
;
|
113
115
|
|
116
|
+
ANALYZE user_agent_type;
|
117
|
+
|
114
118
|
COMMIT;
|
115
119
|
|
116
120
|
CREATE TEMPORARY TABLE IF NOT EXISTS feature_type_stage (LIKE feature_type INCLUDING ALL);
|
@@ -125,6 +129,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
125
129
|
feature_type_name IS NOT NULL
|
126
130
|
;
|
127
131
|
|
132
|
+
ANALYZE feature_type_stage;
|
133
|
+
|
128
134
|
BEGIN;
|
129
135
|
LOCK TABLE feature_type IN EXCLUSIVE MODE;
|
130
136
|
|
@@ -142,6 +148,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
142
148
|
feature_type.name IS NULL
|
143
149
|
;
|
144
150
|
|
151
|
+
ANALYZE feature_type;
|
152
|
+
|
145
153
|
COMMIT;
|
146
154
|
EOS
|
147
155
|
end
|
@@ -24,7 +24,7 @@ require 'spec_helper'
|
|
24
24
|
|
25
25
|
describe Masamune::Transform::RollupFact do
|
26
26
|
before do
|
27
|
-
|
27
|
+
allow_any_instance_of(Masamune::Schema::Table).to receive(:lock_id).and_return(42)
|
28
28
|
|
29
29
|
catalog.schema :postgres do
|
30
30
|
dimension 'cluster', type: :mini do
|
@@ -92,19 +92,16 @@ describe Masamune::Transform::RollupFact do
|
|
92
92
|
|
93
93
|
it 'should eq render rollup_fact template' do
|
94
94
|
is_expected.to eq <<-EOS.strip_heredoc
|
95
|
-
|
96
|
-
CREATE TABLE IF NOT EXISTS visits_hourly_fact_y2014m08_stage_PID (LIKE visits_hourly_fact INCLUDING ALL);
|
95
|
+
SELECT pg_advisory_lock(42);
|
97
96
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
ALTER TABLE visits_hourly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_hourly_fact_y2014m08_stage_PID_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id);
|
104
|
-
ALTER TABLE visits_hourly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_hourly_fact_y2014m08_stage_PID_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id);
|
97
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_stage CASCADE;
|
98
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_stage_tmp CASCADE;
|
99
|
+
|
100
|
+
CREATE TABLE IF NOT EXISTS visits_hourly_fact_y2014m08 (LIKE visits_hourly_fact INCLUDING ALL);
|
101
|
+
CREATE TABLE IF NOT EXISTS visits_hourly_fact_y2014m08_stage (LIKE visits_hourly_fact INCLUDING ALL);
|
105
102
|
|
106
103
|
INSERT INTO
|
107
|
-
|
104
|
+
visits_hourly_fact_y2014m08_stage (date_dimension_id, tenant_dimension_id, user_dimension_id, user_agent_type_id, feature_type_id, total, time_key)
|
108
105
|
SELECT
|
109
106
|
(SELECT id FROM date_dimension d WHERE d.date_epoch = date_dimension.date_epoch ORDER BY d.date_id LIMIT 1),
|
110
107
|
visits_transaction_fact_y2014m08.tenant_dimension_id,
|
@@ -128,37 +125,57 @@ describe Masamune::Transform::RollupFact do
|
|
128
125
|
(visits_transaction_fact_y2014m08.time_key - (visits_transaction_fact_y2014m08.time_key % 3600))
|
129
126
|
;
|
130
127
|
|
131
|
-
|
132
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_date_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (date_dimension_id);
|
133
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_tenant_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (tenant_dimension_id);
|
134
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_user_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (user_dimension_id);
|
135
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_user_agent_type_id_index ON visits_hourly_fact_y2014m08_stage_PID (user_agent_type_id);
|
136
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_feature_type_id_index ON visits_hourly_fact_y2014m08_stage_PID (feature_type_id);
|
137
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_time_key_index ON visits_hourly_fact_y2014m08_stage_PID (time_key);
|
128
|
+
SELECT pg_advisory_lock(ddl_advisory_lock());
|
138
129
|
|
139
130
|
BEGIN;
|
140
|
-
|
141
|
-
|
142
|
-
ALTER TABLE
|
131
|
+
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
132
|
+
|
133
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_time_key_check;
|
134
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_cluster_type_id_fkey CASCADE;
|
135
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_date_dimension_id_fkey CASCADE;
|
136
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_tenant_dimension_id_fkey CASCADE;
|
137
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_user_dimension_id_fkey CASCADE;
|
138
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_user_agent_type_id_fkey CASCADE;
|
139
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_feature_type_id_fkey CASCADE;
|
140
|
+
|
141
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_d6b9b38_index;
|
142
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_0a531a8_index;
|
143
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_d3950d9_index;
|
144
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_39f0fdd_index;
|
145
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_d8b1c3e_index;
|
146
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_33b68fd_index;
|
147
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_6444ed3_index;
|
148
|
+
|
149
|
+
ALTER TABLE visits_hourly_fact_y2014m08 RENAME TO visits_hourly_fact_y2014m08_stage_tmp;
|
150
|
+
ALTER TABLE visits_hourly_fact_y2014m08_stage RENAME TO visits_hourly_fact_y2014m08;
|
143
151
|
|
144
152
|
ALTER TABLE visits_hourly_fact_y2014m08 INHERIT visits_hourly_fact;
|
145
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600)
|
146
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID;
|
147
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID;
|
148
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID;
|
149
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID;
|
150
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID;
|
151
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID;
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
153
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600);
|
154
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
155
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
156
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
157
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
158
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
159
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
160
|
+
|
161
|
+
CREATE INDEX visits_hourly_fact_y2014m08_d6b9b38_index ON visits_hourly_fact_y2014m08 (cluster_type_id);
|
162
|
+
CREATE INDEX visits_hourly_fact_y2014m08_0a531a8_index ON visits_hourly_fact_y2014m08 (date_dimension_id);
|
163
|
+
CREATE INDEX visits_hourly_fact_y2014m08_d3950d9_index ON visits_hourly_fact_y2014m08 (tenant_dimension_id);
|
164
|
+
CREATE INDEX visits_hourly_fact_y2014m08_39f0fdd_index ON visits_hourly_fact_y2014m08 (user_dimension_id);
|
165
|
+
CREATE INDEX visits_hourly_fact_y2014m08_d8b1c3e_index ON visits_hourly_fact_y2014m08 (user_agent_type_id);
|
166
|
+
CREATE INDEX visits_hourly_fact_y2014m08_33b68fd_index ON visits_hourly_fact_y2014m08 (feature_type_id);
|
167
|
+
CREATE INDEX visits_hourly_fact_y2014m08_6444ed3_index ON visits_hourly_fact_y2014m08 (time_key);
|
168
|
+
|
169
|
+
ANALYZE visits_hourly_fact_y2014m08;
|
160
170
|
|
161
171
|
COMMIT;
|
172
|
+
|
173
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_stage_tmp CASCADE;
|
174
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_stage CASCADE;
|
175
|
+
|
176
|
+
SELECT pg_advisory_unlock(ddl_advisory_lock());
|
177
|
+
|
178
|
+
SELECT pg_advisory_unlock(42);
|
162
179
|
EOS
|
163
180
|
end
|
164
181
|
end
|
@@ -172,19 +189,16 @@ describe Masamune::Transform::RollupFact do
|
|
172
189
|
|
173
190
|
it 'should eq render rollup_fact template' do
|
174
191
|
is_expected.to eq <<-EOS.strip_heredoc
|
175
|
-
|
176
|
-
|
192
|
+
SELECT pg_advisory_lock(42);
|
193
|
+
|
194
|
+
DROP TABLE IF EXISTS visits_daily_fact_y2014m08_stage CASCADE;
|
195
|
+
DROP TABLE IF EXISTS visits_daily_fact_y2014m08_stage_tmp CASCADE;
|
177
196
|
|
178
|
-
|
179
|
-
|
180
|
-
ALTER TABLE visits_daily_fact_y2014m08_stage_PID ADD CONSTRAINT visits_daily_fact_y2014m08_stage_PID_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id);
|
181
|
-
ALTER TABLE visits_daily_fact_y2014m08_stage_PID ADD CONSTRAINT visits_daily_fact_y2014m08_stage_PID_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id);
|
182
|
-
ALTER TABLE visits_daily_fact_y2014m08_stage_PID ADD CONSTRAINT visits_daily_fact_y2014m08_stage_PID_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id);
|
183
|
-
ALTER TABLE visits_daily_fact_y2014m08_stage_PID ADD CONSTRAINT visits_daily_fact_y2014m08_stage_PID_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id);
|
184
|
-
ALTER TABLE visits_daily_fact_y2014m08_stage_PID ADD CONSTRAINT visits_daily_fact_y2014m08_stage_PID_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id);
|
197
|
+
CREATE TABLE IF NOT EXISTS visits_daily_fact_y2014m08 (LIKE visits_daily_fact INCLUDING ALL);
|
198
|
+
CREATE TABLE IF NOT EXISTS visits_daily_fact_y2014m08_stage (LIKE visits_daily_fact INCLUDING ALL);
|
185
199
|
|
186
200
|
INSERT INTO
|
187
|
-
|
201
|
+
visits_daily_fact_y2014m08_stage (date_dimension_id, tenant_dimension_id, user_dimension_id, user_agent_type_id, feature_type_id, total, time_key)
|
188
202
|
SELECT
|
189
203
|
(SELECT id FROM date_dimension d WHERE d.date_epoch = date_dimension.date_epoch ORDER BY d.date_id LIMIT 1),
|
190
204
|
visits_hourly_fact_y2014m08.tenant_dimension_id,
|
@@ -207,37 +221,57 @@ describe Masamune::Transform::RollupFact do
|
|
207
221
|
visits_hourly_fact_y2014m08.feature_type_id
|
208
222
|
;
|
209
223
|
|
210
|
-
|
211
|
-
CREATE INDEX visits_daily_fact_y2014m08_stage_PID_date_dimension_id_index ON visits_daily_fact_y2014m08_stage_PID (date_dimension_id);
|
212
|
-
CREATE INDEX visits_daily_fact_y2014m08_stage_PID_tenant_dimension_id_index ON visits_daily_fact_y2014m08_stage_PID (tenant_dimension_id);
|
213
|
-
CREATE INDEX visits_daily_fact_y2014m08_stage_PID_user_dimension_id_index ON visits_daily_fact_y2014m08_stage_PID (user_dimension_id);
|
214
|
-
CREATE INDEX visits_daily_fact_y2014m08_stage_PID_user_agent_type_id_index ON visits_daily_fact_y2014m08_stage_PID (user_agent_type_id);
|
215
|
-
CREATE INDEX visits_daily_fact_y2014m08_stage_PID_feature_type_id_index ON visits_daily_fact_y2014m08_stage_PID (feature_type_id);
|
216
|
-
CREATE INDEX visits_daily_fact_y2014m08_stage_PID_time_key_index ON visits_daily_fact_y2014m08_stage_PID (time_key);
|
224
|
+
SELECT pg_advisory_lock(ddl_advisory_lock());
|
217
225
|
|
218
226
|
BEGIN;
|
219
|
-
|
220
|
-
|
221
|
-
ALTER TABLE
|
227
|
+
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
228
|
+
|
229
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_time_key_check;
|
230
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_cluster_type_id_fkey CASCADE;
|
231
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_date_dimension_id_fkey CASCADE;
|
232
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_tenant_dimension_id_fkey CASCADE;
|
233
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_user_dimension_id_fkey CASCADE;
|
234
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_user_agent_type_id_fkey CASCADE;
|
235
|
+
ALTER TABLE visits_daily_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_daily_fact_y2014m08_feature_type_id_fkey CASCADE;
|
236
|
+
|
237
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_d6b9b38_index;
|
238
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_0a531a8_index;
|
239
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_d3950d9_index;
|
240
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_39f0fdd_index;
|
241
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_d8b1c3e_index;
|
242
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_33b68fd_index;
|
243
|
+
DROP INDEX IF EXISTS visits_daily_fact_y2014m08_6444ed3_index;
|
244
|
+
|
245
|
+
ALTER TABLE visits_daily_fact_y2014m08 RENAME TO visits_daily_fact_y2014m08_stage_tmp;
|
246
|
+
ALTER TABLE visits_daily_fact_y2014m08_stage RENAME TO visits_daily_fact_y2014m08;
|
222
247
|
|
223
248
|
ALTER TABLE visits_daily_fact_y2014m08 INHERIT visits_daily_fact;
|
224
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600)
|
225
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID;
|
226
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID;
|
227
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID;
|
228
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID;
|
229
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID;
|
230
|
-
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID;
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
249
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600);
|
250
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
251
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
252
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
253
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
254
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
255
|
+
ALTER TABLE visits_daily_fact_y2014m08 ADD CONSTRAINT visits_daily_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
256
|
+
|
257
|
+
CREATE INDEX visits_daily_fact_y2014m08_d6b9b38_index ON visits_daily_fact_y2014m08 (cluster_type_id);
|
258
|
+
CREATE INDEX visits_daily_fact_y2014m08_0a531a8_index ON visits_daily_fact_y2014m08 (date_dimension_id);
|
259
|
+
CREATE INDEX visits_daily_fact_y2014m08_d3950d9_index ON visits_daily_fact_y2014m08 (tenant_dimension_id);
|
260
|
+
CREATE INDEX visits_daily_fact_y2014m08_39f0fdd_index ON visits_daily_fact_y2014m08 (user_dimension_id);
|
261
|
+
CREATE INDEX visits_daily_fact_y2014m08_d8b1c3e_index ON visits_daily_fact_y2014m08 (user_agent_type_id);
|
262
|
+
CREATE INDEX visits_daily_fact_y2014m08_33b68fd_index ON visits_daily_fact_y2014m08 (feature_type_id);
|
263
|
+
CREATE INDEX visits_daily_fact_y2014m08_6444ed3_index ON visits_daily_fact_y2014m08 (time_key);
|
264
|
+
|
265
|
+
ANALYZE visits_daily_fact_y2014m08;
|
239
266
|
|
240
267
|
COMMIT;
|
268
|
+
|
269
|
+
DROP TABLE IF EXISTS visits_daily_fact_y2014m08_stage_tmp CASCADE;
|
270
|
+
DROP TABLE IF EXISTS visits_daily_fact_y2014m08_stage CASCADE;
|
271
|
+
|
272
|
+
SELECT pg_advisory_unlock(ddl_advisory_lock());
|
273
|
+
|
274
|
+
SELECT pg_advisory_unlock(42);
|
241
275
|
EOS
|
242
276
|
end
|
243
277
|
end
|
@@ -251,19 +285,16 @@ describe Masamune::Transform::RollupFact do
|
|
251
285
|
|
252
286
|
it 'should eq render rollup_fact template' do
|
253
287
|
is_expected.to eq <<-EOS.strip_heredoc
|
254
|
-
|
255
|
-
CREATE TABLE IF NOT EXISTS visits_monthly_fact_y2014m08_stage_PID (LIKE visits_monthly_fact INCLUDING ALL);
|
288
|
+
SELECT pg_advisory_lock(42);
|
256
289
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
ALTER TABLE visits_monthly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_monthly_fact_y2014m08_stage_PID_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id);
|
263
|
-
ALTER TABLE visits_monthly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_monthly_fact_y2014m08_stage_PID_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id);
|
290
|
+
DROP TABLE IF EXISTS visits_monthly_fact_y2014m08_stage CASCADE;
|
291
|
+
DROP TABLE IF EXISTS visits_monthly_fact_y2014m08_stage_tmp CASCADE;
|
292
|
+
|
293
|
+
CREATE TABLE IF NOT EXISTS visits_monthly_fact_y2014m08 (LIKE visits_monthly_fact INCLUDING ALL);
|
294
|
+
CREATE TABLE IF NOT EXISTS visits_monthly_fact_y2014m08_stage (LIKE visits_monthly_fact INCLUDING ALL);
|
264
295
|
|
265
296
|
INSERT INTO
|
266
|
-
|
297
|
+
visits_monthly_fact_y2014m08_stage (date_dimension_id, tenant_dimension_id, user_dimension_id, user_agent_type_id, feature_type_id, total, time_key)
|
267
298
|
SELECT
|
268
299
|
(SELECT id FROM date_dimension d WHERE d.month_epoch = date_dimension.month_epoch ORDER BY d.date_id LIMIT 1),
|
269
300
|
visits_daily_fact_y2014m08.tenant_dimension_id,
|
@@ -286,37 +317,57 @@ describe Masamune::Transform::RollupFact do
|
|
286
317
|
visits_daily_fact_y2014m08.feature_type_id
|
287
318
|
;
|
288
319
|
|
289
|
-
|
290
|
-
CREATE INDEX visits_monthly_fact_y2014m08_stage_PID_date_dimension_id_index ON visits_monthly_fact_y2014m08_stage_PID (date_dimension_id);
|
291
|
-
CREATE INDEX visits_monthly_fact_y2014m08_stage_PID_tenant_dimension_id_index ON visits_monthly_fact_y2014m08_stage_PID (tenant_dimension_id);
|
292
|
-
CREATE INDEX visits_monthly_fact_y2014m08_stage_PID_user_dimension_id_index ON visits_monthly_fact_y2014m08_stage_PID (user_dimension_id);
|
293
|
-
CREATE INDEX visits_monthly_fact_y2014m08_stage_PID_user_agent_type_id_index ON visits_monthly_fact_y2014m08_stage_PID (user_agent_type_id);
|
294
|
-
CREATE INDEX visits_monthly_fact_y2014m08_stage_PID_feature_type_id_index ON visits_monthly_fact_y2014m08_stage_PID (feature_type_id);
|
295
|
-
CREATE INDEX visits_monthly_fact_y2014m08_stage_PID_time_key_index ON visits_monthly_fact_y2014m08_stage_PID (time_key);
|
320
|
+
SELECT pg_advisory_lock(ddl_advisory_lock());
|
296
321
|
|
297
322
|
BEGIN;
|
298
|
-
|
299
|
-
|
300
|
-
ALTER TABLE
|
323
|
+
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
324
|
+
|
325
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_time_key_check;
|
326
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_cluster_type_id_fkey CASCADE;
|
327
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_date_dimension_id_fkey CASCADE;
|
328
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_tenant_dimension_id_fkey CASCADE;
|
329
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_user_dimension_id_fkey CASCADE;
|
330
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_user_agent_type_id_fkey CASCADE;
|
331
|
+
ALTER TABLE visits_monthly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_monthly_fact_y2014m08_feature_type_id_fkey CASCADE;
|
332
|
+
|
333
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_d6b9b38_index;
|
334
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_0a531a8_index;
|
335
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_d3950d9_index;
|
336
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_39f0fdd_index;
|
337
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_d8b1c3e_index;
|
338
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_33b68fd_index;
|
339
|
+
DROP INDEX IF EXISTS visits_monthly_fact_y2014m08_6444ed3_index;
|
340
|
+
|
341
|
+
ALTER TABLE visits_monthly_fact_y2014m08 RENAME TO visits_monthly_fact_y2014m08_stage_tmp;
|
342
|
+
ALTER TABLE visits_monthly_fact_y2014m08_stage RENAME TO visits_monthly_fact_y2014m08;
|
301
343
|
|
302
344
|
ALTER TABLE visits_monthly_fact_y2014m08 INHERIT visits_monthly_fact;
|
303
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600)
|
304
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID;
|
305
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID;
|
306
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID;
|
307
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID;
|
308
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID;
|
309
|
-
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID;
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
345
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600);
|
346
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
347
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
348
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
349
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
350
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
351
|
+
ALTER TABLE visits_monthly_fact_y2014m08 ADD CONSTRAINT visits_monthly_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
352
|
+
|
353
|
+
CREATE INDEX visits_monthly_fact_y2014m08_d6b9b38_index ON visits_monthly_fact_y2014m08 (cluster_type_id);
|
354
|
+
CREATE INDEX visits_monthly_fact_y2014m08_0a531a8_index ON visits_monthly_fact_y2014m08 (date_dimension_id);
|
355
|
+
CREATE INDEX visits_monthly_fact_y2014m08_d3950d9_index ON visits_monthly_fact_y2014m08 (tenant_dimension_id);
|
356
|
+
CREATE INDEX visits_monthly_fact_y2014m08_39f0fdd_index ON visits_monthly_fact_y2014m08 (user_dimension_id);
|
357
|
+
CREATE INDEX visits_monthly_fact_y2014m08_d8b1c3e_index ON visits_monthly_fact_y2014m08 (user_agent_type_id);
|
358
|
+
CREATE INDEX visits_monthly_fact_y2014m08_33b68fd_index ON visits_monthly_fact_y2014m08 (feature_type_id);
|
359
|
+
CREATE INDEX visits_monthly_fact_y2014m08_6444ed3_index ON visits_monthly_fact_y2014m08 (time_key);
|
360
|
+
|
361
|
+
ANALYZE visits_monthly_fact_y2014m08;
|
318
362
|
|
319
363
|
COMMIT;
|
364
|
+
|
365
|
+
DROP TABLE IF EXISTS visits_monthly_fact_y2014m08_stage_tmp CASCADE;
|
366
|
+
DROP TABLE IF EXISTS visits_monthly_fact_y2014m08_stage CASCADE;
|
367
|
+
|
368
|
+
SELECT pg_advisory_unlock(ddl_advisory_lock());
|
369
|
+
|
370
|
+
SELECT pg_advisory_unlock(42);
|
320
371
|
EOS
|
321
372
|
end
|
322
373
|
end
|
@@ -24,7 +24,7 @@ require 'spec_helper'
|
|
24
24
|
|
25
25
|
describe Masamune::Transform::StageFact do
|
26
26
|
before do
|
27
|
-
|
27
|
+
allow_any_instance_of(Masamune::Schema::Table).to receive(:lock_id).and_return(42)
|
28
28
|
|
29
29
|
catalog.schema :postgres do
|
30
30
|
dimension 'cluster', type: :mini do
|
@@ -102,20 +102,16 @@ describe Masamune::Transform::StageFact do
|
|
102
102
|
|
103
103
|
it 'should eq render stage_fact template' do
|
104
104
|
is_expected.to eq <<-EOS.strip_heredoc
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
ALTER TABLE visits_hourly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_hourly_fact_y2014m08_stage_PID_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id);
|
113
|
-
ALTER TABLE visits_hourly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_hourly_fact_y2014m08_stage_PID_group_dimension_id_fkey FOREIGN KEY (group_dimension_id) REFERENCES group_dimension(id);
|
114
|
-
ALTER TABLE visits_hourly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_hourly_fact_y2014m08_stage_PID_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id);
|
115
|
-
ALTER TABLE visits_hourly_fact_y2014m08_stage_PID ADD CONSTRAINT visits_hourly_fact_y2014m08_stage_PID_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id);
|
105
|
+
SELECT pg_advisory_lock(42);
|
106
|
+
|
107
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_stage CASCADE;
|
108
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_tmp CASCADE;
|
109
|
+
|
110
|
+
CREATE TABLE IF NOT EXISTS visits_hourly_fact_y2014m08_stage (LIKE visits_hourly_fact INCLUDING ALL);
|
111
|
+
CREATE TABLE IF NOT EXISTS visits_hourly_fact_y2014m08 (LIKE visits_hourly_fact INCLUDING ALL);
|
116
112
|
|
117
113
|
INSERT INTO
|
118
|
-
|
114
|
+
visits_hourly_fact_y2014m08_stage (date_dimension_id, tenant_dimension_id, user_dimension_id, group_dimension_id, user_agent_type_id, feature_type_id, session_type_id, total, time_key)
|
119
115
|
SELECT
|
120
116
|
date_dimension.id,
|
121
117
|
tenant_dimension.id,
|
@@ -160,42 +156,63 @@ describe Masamune::Transform::StageFact do
|
|
160
156
|
feature_type.name = visits_hourly_file_fact_stage.feature_type_name
|
161
157
|
;
|
162
158
|
|
163
|
-
|
164
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_date_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (date_dimension_id);
|
165
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_tenant_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (tenant_dimension_id);
|
166
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_user_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (user_dimension_id);
|
167
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_group_dimension_id_index ON visits_hourly_fact_y2014m08_stage_PID (group_dimension_id);
|
168
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_user_agent_type_id_index ON visits_hourly_fact_y2014m08_stage_PID (user_agent_type_id);
|
169
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_feature_type_id_index ON visits_hourly_fact_y2014m08_stage_PID (feature_type_id);
|
170
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_session_type_id_index ON visits_hourly_fact_y2014m08_stage_PID (session_type_id);
|
171
|
-
CREATE INDEX visits_hourly_fact_y2014m08_stage_PID_time_key_index ON visits_hourly_fact_y2014m08_stage_PID (time_key);
|
159
|
+
SELECT pg_advisory_lock(ddl_advisory_lock());
|
172
160
|
|
173
161
|
BEGIN;
|
174
|
-
|
175
|
-
|
176
|
-
ALTER TABLE
|
162
|
+
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
163
|
+
|
164
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_time_key_check;
|
165
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_cluster_type_id_fkey CASCADE;
|
166
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_date_dimension_id_fkey CASCADE;
|
167
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_tenant_dimension_id_fkey CASCADE;
|
168
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_user_dimension_id_fkey CASCADE;
|
169
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_group_dimension_id_fkey CASCADE;
|
170
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_user_agent_type_id_fkey CASCADE;
|
171
|
+
ALTER TABLE visits_hourly_fact_y2014m08 DROP CONSTRAINT IF EXISTS visits_hourly_fact_y2014m08_feature_type_id_fkey CASCADE;
|
172
|
+
|
173
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_d6b9b38_index;
|
174
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_0a531a8_index;
|
175
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_d3950d9_index;
|
176
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_39f0fdd_index;
|
177
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_e0d2a9e_index;
|
178
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_d8b1c3e_index;
|
179
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_33b68fd_index;
|
180
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_422efee_index;
|
181
|
+
DROP INDEX IF EXISTS visits_hourly_fact_y2014m08_6444ed3_index;
|
182
|
+
|
183
|
+
ALTER TABLE visits_hourly_fact_y2014m08 RENAME TO visits_hourly_fact_y2014m08_tmp;
|
184
|
+
ALTER TABLE visits_hourly_fact_y2014m08_stage RENAME TO visits_hourly_fact_y2014m08;
|
177
185
|
|
178
186
|
ALTER TABLE visits_hourly_fact_y2014m08 INHERIT visits_hourly_fact;
|
179
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600)
|
180
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID;
|
181
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID;
|
182
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID;
|
183
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID;
|
184
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_group_dimension_id_fkey FOREIGN KEY (group_dimension_id) REFERENCES group_dimension(id) NOT VALID;
|
185
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID;
|
186
|
-
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID;
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
187
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_time_key_check CHECK (time_key >= 1406851200 AND time_key < 1409529600);
|
188
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_cluster_type_id_fkey FOREIGN KEY (cluster_type_id) REFERENCES cluster_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
189
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_date_dimension_id_fkey FOREIGN KEY (date_dimension_id) REFERENCES date_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
190
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_tenant_dimension_id_fkey FOREIGN KEY (tenant_dimension_id) REFERENCES tenant_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
191
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_dimension_id_fkey FOREIGN KEY (user_dimension_id) REFERENCES user_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
192
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_group_dimension_id_fkey FOREIGN KEY (group_dimension_id) REFERENCES group_dimension(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
193
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_user_agent_type_id_fkey FOREIGN KEY (user_agent_type_id) REFERENCES user_agent_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
194
|
+
ALTER TABLE visits_hourly_fact_y2014m08 ADD CONSTRAINT visits_hourly_fact_y2014m08_feature_type_id_fkey FOREIGN KEY (feature_type_id) REFERENCES feature_type(id) NOT VALID DEFERRABLE INITIALLY DEFERRED;
|
195
|
+
|
196
|
+
CREATE INDEX visits_hourly_fact_y2014m08_d6b9b38_index ON visits_hourly_fact_y2014m08 (cluster_type_id);
|
197
|
+
CREATE INDEX visits_hourly_fact_y2014m08_0a531a8_index ON visits_hourly_fact_y2014m08 (date_dimension_id);
|
198
|
+
CREATE INDEX visits_hourly_fact_y2014m08_d3950d9_index ON visits_hourly_fact_y2014m08 (tenant_dimension_id);
|
199
|
+
CREATE INDEX visits_hourly_fact_y2014m08_39f0fdd_index ON visits_hourly_fact_y2014m08 (user_dimension_id);
|
200
|
+
CREATE INDEX visits_hourly_fact_y2014m08_e0d2a9e_index ON visits_hourly_fact_y2014m08 (group_dimension_id);
|
201
|
+
CREATE INDEX visits_hourly_fact_y2014m08_d8b1c3e_index ON visits_hourly_fact_y2014m08 (user_agent_type_id);
|
202
|
+
CREATE INDEX visits_hourly_fact_y2014m08_33b68fd_index ON visits_hourly_fact_y2014m08 (feature_type_id);
|
203
|
+
CREATE INDEX visits_hourly_fact_y2014m08_422efee_index ON visits_hourly_fact_y2014m08 (session_type_id);
|
204
|
+
CREATE INDEX visits_hourly_fact_y2014m08_6444ed3_index ON visits_hourly_fact_y2014m08 (time_key);
|
205
|
+
|
206
|
+
ANALYZE visits_hourly_fact_y2014m08;
|
197
207
|
|
198
208
|
COMMIT;
|
209
|
+
|
210
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_tmp CASCADE;
|
211
|
+
DROP TABLE IF EXISTS visits_hourly_fact_y2014m08_stage CASCADE;
|
212
|
+
|
213
|
+
SELECT pg_advisory_unlock(ddl_advisory_lock());
|
214
|
+
|
215
|
+
SELECT pg_advisory_unlock(42);
|
199
216
|
EOS
|
200
217
|
end
|
201
218
|
end
|
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.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Andrews
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|