postspec 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/postspec/frame.rb +2 -1
- data/lib/postspec/render.rb +2 -5
- data/lib/postspec/version.rb +1 -1
- data/lib/postspec.rb +3 -0
- data/lib/postspec_helper.rb +1 -0
- data/lib/share/postspec_schema.sql +7 -0
- data/performance/performance_spec.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a391625a2f772e728fcc9c7eb0626e47a5cdacb43e770afe239da3cac393606
|
|
4
|
+
data.tar.gz: efc3dd134049aff64eb4f459e22a74ecdae6e8333123baa5433444275e1cdde7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac0f2dc6771a9f3949ae02448d6c399f8387647f35fce871543eba99c803a71a6edfdc2ba4fc4c473f3f8837b120f64e152a989fc0e436de6b9995d7409c00d2
|
|
7
|
+
data.tar.gz: d78238c6edff5869caf9cbba9d4ce34329f1e3fe49dfba31431951092af8df06bc26e164e7372c72c5cd00a14d0dbb612abd980109e288f6b23e47ecdd3cfb63
|
data/lib/postspec/frame.rb
CHANGED
|
@@ -84,7 +84,8 @@ module Postspec
|
|
|
84
84
|
attr_reader :data
|
|
85
85
|
alias_method :sql, :push_sql
|
|
86
86
|
|
|
87
|
-
# Note FoxFrame::new computes the fox object
|
|
87
|
+
# Note FoxFrame::new computes the fox object. It has four arguments instead
|
|
88
|
+
# of the five below
|
|
88
89
|
def initialize(parent, search_path, fox, data, push_sql)
|
|
89
90
|
@fox = fox
|
|
90
91
|
@data = data
|
data/lib/postspec/render.rb
CHANGED
|
@@ -52,12 +52,9 @@ module Postspec
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def drop_seed_triggers
|
|
55
|
-
p "DROP"
|
|
56
55
|
postspec.tables.map { |uid|
|
|
57
|
-
p "BING"
|
|
58
56
|
[SEED_BUD_TRIGGER_NAME, SEED_BT_TRIGGER_NAME].map { |trigger|
|
|
59
57
|
trigger_uid = "#{uid}.#{trigger}()"
|
|
60
|
-
p trigger_uid
|
|
61
58
|
postspec.meta.exist?(trigger_uid) ? "drop trigger #{trigger} on #{uid}" : nil
|
|
62
59
|
}.compact
|
|
63
60
|
}.flatten
|
|
@@ -76,13 +73,13 @@ module Postspec
|
|
|
76
73
|
create trigger #{SEED_BUD_TRIGGER_NAME}
|
|
77
74
|
before update or delete on #{uid}
|
|
78
75
|
for each row
|
|
79
|
-
when (
|
|
76
|
+
when (OLD.id <= #{id})
|
|
80
77
|
execute function postspec.readonly_failure('#{uid}')
|
|
81
78
|
EOS1
|
|
82
79
|
bt_sql = <<~EOS2
|
|
83
80
|
create trigger postspec_readonly_bt_trg
|
|
84
81
|
before truncate on #{uid}
|
|
85
|
-
execute function postspec.
|
|
82
|
+
execute function postspec.truncate_failure('#{uid}')
|
|
86
83
|
EOS2
|
|
87
84
|
[
|
|
88
85
|
bud_sql.chomp,
|
data/lib/postspec/version.rb
CHANGED
data/lib/postspec.rb
CHANGED
|
@@ -184,6 +184,9 @@ module Postspec
|
|
|
184
184
|
# Transactionn timestamp with time zone
|
|
185
185
|
def timestamptz() @conn.timestamptz end
|
|
186
186
|
|
|
187
|
+
# Date of timestamp
|
|
188
|
+
def datestamp() timestamp.to_date end
|
|
189
|
+
|
|
187
190
|
# True if no tests failed. Default true
|
|
188
191
|
def success?() @success end
|
|
189
192
|
|
data/lib/postspec_helper.rb
CHANGED
|
@@ -8,6 +8,7 @@ def fox() postspec.fox end
|
|
|
8
8
|
def db() postspec.db end
|
|
9
9
|
def timestamp() postspec.timestamp end
|
|
10
10
|
def timestamptz() postspec.timestamptz end
|
|
11
|
+
def datestamp() postspec.datestamp end
|
|
11
12
|
def data() postspec.data end
|
|
12
13
|
def inserted_records() postspec.inserted end
|
|
13
14
|
def updated_records() postspec.updated end
|
|
@@ -55,6 +55,13 @@ create or replace function readonly_failure() returns trigger as $$
|
|
|
55
55
|
end;
|
|
56
56
|
$$ language plpgsql immutable leakproof;
|
|
57
57
|
|
|
58
|
+
create or replace function truncate_failure() returns trigger as $$
|
|
59
|
+
begin
|
|
60
|
+
raise 'Postspec: Can''t modify truncate %.%', TG_TABLE_SCHEMA, TG_TABLE_NAME;
|
|
61
|
+
return null;
|
|
62
|
+
end;
|
|
63
|
+
$$ language plpgsql immutable leakproof;
|
|
64
|
+
|
|
58
65
|
-- :call-seq:
|
|
59
66
|
-- register_insert(record_id)
|
|
60
67
|
--
|
|
@@ -11,8 +11,8 @@ describe "'use' performance" do
|
|
|
11
11
|
describe "timing..." do
|
|
12
12
|
t0 = nil
|
|
13
13
|
|
|
14
|
-
before(:all) {
|
|
15
|
-
t0 = Time.now
|
|
14
|
+
before(:all) {
|
|
15
|
+
t0 = Time.now
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
after(:all) {
|
|
@@ -47,8 +47,8 @@ describe "'statement with #db' performance" do
|
|
|
47
47
|
|
|
48
48
|
describe "timing..." do
|
|
49
49
|
|
|
50
|
-
before(:all) {
|
|
51
|
-
t0 = Time.now
|
|
50
|
+
before(:all) {
|
|
51
|
+
t0 = Time.now
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
after(:all) {
|
|
@@ -84,8 +84,8 @@ describe "'statement with #data' performance" do
|
|
|
84
84
|
|
|
85
85
|
describe "timing..." do
|
|
86
86
|
|
|
87
|
-
before(:all) {
|
|
88
|
-
t0 = Time.now
|
|
87
|
+
before(:all) {
|
|
88
|
+
t0 = Time.now
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
after(:all) {
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: postspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claus Rasmussen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-inflector
|