prick 0.25.1 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/builder/builder.rb +2 -2
- data/lib/builder/node.rb +2 -2
- data/lib/prick/version.rb +1 -1
- data/lib/subcommand/prick-build.rb +0 -4
- data/lib/subcommand/prick-make.rb +15 -7
- 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: 3fcaa84e14ed58667eaa0752b5dec5ba5786f3a32b2a598d8d78ab6636817e65
|
4
|
+
data.tar.gz: b9582bdb7d6733b0aaf50675581135e2c04fabe322d7c8ccbec5481569a7ec04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72cb0ca152e3805131079e3e9d473eb1fb8623d571bbdeddd398e943dc199bb31f5f0c1e94f78c163211dbc5bd2fcad5858e3ad11331e6a5fea70c898d07a047
|
7
|
+
data.tar.gz: bdd15924608544c695c2932b1a7e3581307917bced9f2a449caeb56962aa17546ed8a6314ce5f7450a519c01288c883d1d82d1980145d81ad1e9928e906ce207
|
data/lib/builder/builder.rb
CHANGED
@@ -34,7 +34,7 @@ module Prick
|
|
34
34
|
forward_to :pool, :schemas,
|
35
35
|
:nodes, :decl_nodes, :init_nodes, :term_nodes,
|
36
36
|
:seed_nodes, :fox_seed_nodes, :sql_seed_nodes,
|
37
|
-
:
|
37
|
+
:build_nodes,
|
38
38
|
:pg_graph_ignore_schemas,
|
39
39
|
:refresh_schemas, :keep_schemas
|
40
40
|
|
@@ -92,7 +92,7 @@ module Prick
|
|
92
92
|
|
93
93
|
def execute(conn, create_schemas: schemas)
|
94
94
|
group if batches.nil?
|
95
|
-
conn.exec create_schemas.
|
95
|
+
conn.exec create_schemas.map { |schema| "create schema #{schema}" }
|
96
96
|
for batch in batches
|
97
97
|
batch.execute
|
98
98
|
end
|
data/lib/builder/node.rb
CHANGED
@@ -61,7 +61,7 @@ module Prick
|
|
61
61
|
def read_source
|
62
62
|
file = File.read(path)
|
63
63
|
@source_lines = 1 + 1 + file.count("\n")
|
64
|
-
["set search_path to #{schema};\n", file]
|
64
|
+
["set search_path to #{schema}, pg_temp;\n", file]
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -152,7 +152,7 @@ module Prick
|
|
152
152
|
raise Prick::Error, "Failed executing #{path} called from #{parent.path}"
|
153
153
|
end
|
154
154
|
@source_lines = 1 + 1 + sql.count("\n")
|
155
|
-
["set search_path to #{schema};\n", sql]
|
155
|
+
["set search_path to #{schema}, pg_temp;\n", sql]
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
data/lib/prick/version.rb
CHANGED
@@ -48,10 +48,6 @@ module Prick::SubCommand
|
|
48
48
|
|
49
49
|
# Drop refresh schemes
|
50
50
|
refresh_schemas.each { |schema| conn.schema.drop(schema, cascade: true) }
|
51
|
-
|
52
|
-
# Re-create public schema
|
53
|
-
conn.schema.create("public", authorization: "postgres")
|
54
|
-
conn.exec "grant usage, create on schema public to public"
|
55
51
|
end
|
56
52
|
end
|
57
53
|
|
@@ -5,7 +5,7 @@ require 'builder/builder.rb'
|
|
5
5
|
module Prick::SubCommand
|
6
6
|
def self.make(database, username, schema, timer: nil, dump: nil)
|
7
7
|
Timer.on! if timer
|
8
|
-
time "Prick::Command#
|
8
|
+
time "Prick::Command#make" do
|
9
9
|
begin
|
10
10
|
super_conn = PgConn.new
|
11
11
|
conn = nil
|
@@ -17,7 +17,7 @@ module Prick::SubCommand
|
|
17
17
|
time "Load build object" do
|
18
18
|
if super_conn.rdbms.exist? database
|
19
19
|
conn = PgConn.new(database, username)
|
20
|
-
if conn.schema.exist_table?
|
20
|
+
if conn.schema.exist_table?("prick", "versions") && !conn.empty?("prick.versions")
|
21
21
|
built_at = conn.value("select built_at from prick.versions")
|
22
22
|
end
|
23
23
|
else
|
@@ -28,11 +28,19 @@ module Prick::SubCommand
|
|
28
28
|
|
29
29
|
builder = Prick::Build::Builder.new(conn, "schema", clean)
|
30
30
|
|
31
|
-
if schema
|
32
|
-
builder.pool.after_schema(schema)
|
33
|
-
|
34
|
-
|
31
|
+
if schema
|
32
|
+
after_schemas = builder.pool.after_schema(schema)
|
33
|
+
refresh_schemas = builder.pool.refresh_schemas
|
34
|
+
conn.schema.drop(schema, cascade: true) # Marks it dirty
|
35
|
+
|
36
|
+
# Nuke later schemas
|
37
|
+
# FIXME Not a good idea when sitting on a leaf schema.
|
38
|
+
# Forced-delete could be requested using 'prick make schema'
|
39
|
+
#
|
40
|
+
(after_schemas & refresh_schemas).each { |drop_schema|
|
41
|
+
conn.schema.drop(drop_schema, cascade: true)
|
35
42
|
}
|
43
|
+
after_schemas.each { |delete_schema| builder.pool.delete_schema(delete_schema) }
|
36
44
|
end
|
37
45
|
|
38
46
|
touched_nodes = builder.nodes.select { |node| File.mtime(node.path) > built_at }
|
@@ -41,7 +49,7 @@ module Prick::SubCommand
|
|
41
49
|
touched_schema = touched_nodes.first&.schema
|
42
50
|
missing_schema = builder.schemas.find { |schema| !conn.schema.exist?(schema) }
|
43
51
|
build_schema = builder.schemas.find { |schema| [touched_schema, missing_schema].include? schema }
|
44
|
-
|
52
|
+
|
45
53
|
if build_schema.nil?
|
46
54
|
puts "#{database} is up to date"
|
47
55
|
exit
|
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.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|