prick 0.39.7 → 0.39.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prick/builder/batch.rb +4 -0
- data/lib/prick/builder/builder.rb +5 -2
- data/lib/prick/builder/node.rb +1 -1
- data/lib/prick/local/timer.rb +1 -1
- data/lib/prick/state.rb +2 -2
- data/lib/prick/subcommand/prick-drop.rb +2 -2
- data/lib/prick/version.rb +1 -1
- 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: db7a57d14d65cd631793874989d504c0b9aeeeee1022e4d57fd451ff62663e19
|
4
|
+
data.tar.gz: 20c53aa36943b9b2d8dd17c4f4fbc125d6b416392251f98b03cbbbe5e015a5eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312a5a5e15b995d47b75464ca5284e8b192f978dcf3ab6cc6a282fe482aeff2a76a6ff18be1d6b67b7aa44b4864378f7d02ffe06d184a88ff79cc9f8395dea0e
|
7
|
+
data.tar.gz: 8f952347b1992b473904a5865a612f72717b4376c357392cae82b4db60904b30e336ccafc9ee63f6566a258bbe109d5745e5aab5cbbabf52d25d4469cfd56750
|
data/lib/prick/builder/batch.rb
CHANGED
@@ -16,9 +16,13 @@ module Prick
|
|
16
16
|
|
17
17
|
def execute(**opts, &block)
|
18
18
|
name = self.class.to_s.sub(/.*::/, "").split(/(?=[A-Z])/).map(&:downcase).join(" ")
|
19
|
+
node_paths = nodes.map(&:relpath)
|
19
20
|
time "Execute #{name} (nodes: #{nodes.size})" do
|
20
21
|
yield(**opts)
|
21
22
|
end
|
23
|
+
if Timer.on?
|
24
|
+
::Timer.file.indent { |f| f.puts node_paths }
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
def dump
|
@@ -88,6 +88,7 @@ module Prick
|
|
88
88
|
batch = nil
|
89
89
|
|
90
90
|
for node in [init_nodes, decl_nodes, fox_seed_nodes, sql_seed_nodes, term_nodes.reverse].flatten
|
91
|
+
# Create new batch if required. Order of when-clauses is important
|
91
92
|
case node.kind
|
92
93
|
when :module
|
93
94
|
if batch&.kind != :module
|
@@ -103,7 +104,7 @@ module Prick
|
|
103
104
|
batch = SqlBatch.new(self)
|
104
105
|
end
|
105
106
|
when :sql || node.kind == :inline
|
106
|
-
if batch&.kind != :exe
|
107
|
+
if batch&.kind != :exe || step
|
107
108
|
@batches << batch if batch
|
108
109
|
batch = SqlBatch.new(self)
|
109
110
|
end
|
@@ -113,11 +114,13 @@ module Prick
|
|
113
114
|
when :fox
|
114
115
|
@batches << batch if batch
|
115
116
|
batch = FoxBatch.new(self)
|
116
|
-
when :yml
|
117
|
+
when :yml # build.yml files
|
117
118
|
next
|
118
119
|
else
|
119
120
|
raise Error, "Unexpected node kind: #{node.kind}"
|
120
121
|
end
|
122
|
+
|
123
|
+
# Add node to current batch
|
121
124
|
batch.nodes << node
|
122
125
|
end
|
123
126
|
@batches << batch if batch
|
data/lib/prick/builder/node.rb
CHANGED
@@ -9,6 +9,7 @@ module Prick
|
|
9
9
|
attr_reader :args # only defined for :exe (String)
|
10
10
|
|
11
11
|
def name() @name = File.basename(path) end
|
12
|
+
def relpath = path.sub(/^#{Dir.getwd}\//, "")
|
12
13
|
|
13
14
|
# Note that schema defaults to 'public' which may not be what you want in
|
14
15
|
# some cases
|
@@ -126,7 +127,6 @@ module Prick
|
|
126
127
|
alias_method :command, :to_s
|
127
128
|
|
128
129
|
def filename = File.basename(path)
|
129
|
-
def relpath = path.sub(/^#{Dir.getwd}\//, "")
|
130
130
|
|
131
131
|
def initialize(parent, phase, path, args = nil)
|
132
132
|
constrain args, [String]
|
data/lib/prick/local/timer.rb
CHANGED
data/lib/prick/state.rb
CHANGED
@@ -357,12 +357,12 @@ module Prick
|
|
357
357
|
|
358
358
|
def insert_record(table, attrs = {})
|
359
359
|
sql_fields = attrs.keys.join(", ")
|
360
|
-
sql_values = attrs.values.map { conn.
|
360
|
+
sql_values = attrs.values.map { conn.quote_value(_1) }.join(", ")
|
361
361
|
conn.value "insert into #{table} (#{sql_fields}) values (#{sql_values}) returning id"
|
362
362
|
end
|
363
363
|
|
364
364
|
def update_record(table, id, attrs = {})
|
365
|
-
sql_assign = attrs.map { |k,v| "#{conn.quote_identifier(k)} = #{conn.
|
365
|
+
sql_assign = attrs.map { |k,v| "#{conn.quote_identifier(k)} = #{conn.quote_value(v)}" }.join(", ")
|
366
366
|
sql_id_cond = (id.nil? ? "true" : "id = #{id}")
|
367
367
|
conn.exec "update #{table} set #{sql_assign} where #{sql_id_cond}"
|
368
368
|
end
|
@@ -50,8 +50,8 @@ module Prick::SubCommand
|
|
50
50
|
pool = builder.pool
|
51
51
|
schemas = pool.refresh_schemas
|
52
52
|
end
|
53
|
-
schema_list = conn.
|
54
|
-
schema_expr = schemas ? "true = true" : "schema_name in #{schema_list}"
|
53
|
+
schema_list = conn.quote_values(schemas)
|
54
|
+
schema_expr = schemas ? "true = true" : "schema_name in (#{schema_list})"
|
55
55
|
tables = conn.tuples %(
|
56
56
|
select schema_name, table_name, max_id
|
57
57
|
from prick.snapshots
|
data/lib/prick/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.39.
|
4
|
+
version: 0.39.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|