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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c76b0bc51fa4b3303cadc824bb4ff0d1b9c2c76fd1d013bad4aa006737b7311e
4
- data.tar.gz: 0a4b305df2d73da8a57c0d6f87494d796099fe7b1bdbb3970c372a41a92b36b5
3
+ metadata.gz: 3fcaa84e14ed58667eaa0752b5dec5ba5786f3a32b2a598d8d78ab6636817e65
4
+ data.tar.gz: b9582bdb7d6733b0aaf50675581135e2c04fabe322d7c8ccbec5481569a7ec04
5
5
  SHA512:
6
- metadata.gz: 77fe61ee4e5d5583bed6dc63f85cafdeb5fb84fac7cc4fb1c8afb1854d9315d9d77d7b8a4607049581c81608617edfe73a986df7b2518d4acaa6be64c69241e8
7
- data.tar.gz: c198b0391e2484951ec34e158f358dc5ac29537b247d72505abb9a9b1b80414c49b89b6c8790b03e4ccdefe76b1180aa0158ec4d34d1115682b7d53d79aad752
6
+ metadata.gz: 72cb0ca152e3805131079e3e9d473eb1fb8623d571bbdeddd398e943dc199bb31f5f0c1e94f78c163211dbc5bd2fcad5858e3ad11331e6a5fea70c898d07a047
7
+ data.tar.gz: bdd15924608544c695c2932b1a7e3581307917bced9f2a449caeb56962aa17546ed8a6314ce5f7450a519c01288c883d1d82d1980145d81ad1e9928e906ce207
@@ -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
- :builder_nodes,
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.grep_v("public").map { |schema| "create schema #{schema}" }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prick
4
- VERSION = "0.25.1"
4
+ VERSION = "0.26.0"
5
5
  end
@@ -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#build" do
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? "prick", "versions"
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).each { |schema|
33
- conn.schema.drop(schema, cascade: true)
34
- builder.pool.delete_schema(schema)
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.25.1
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-08-14 00:00:00.000000000 Z
11
+ date: 2023-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic