prick 0.20.14 → 0.20.17

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: 863269702a01df7b25038a6eae9e0b2f636e20311276919cdecf6f201540d14b
4
- data.tar.gz: bdf5d57641b5e250d667ff924eacd02e0a1972ea40e756346642229c815ed8b0
3
+ metadata.gz: 0a3550348676d001eaf4c5079c6f0bfc1f1caba9eb05a8920f56d4761e0f333f
4
+ data.tar.gz: ca409eef164d2fda047600b1f5ac609fc0626ca84e8266b501af2fdad7f4a992
5
5
  SHA512:
6
- metadata.gz: c1228157e01f3d08383e6addddeabe9f7c9bf66cba682af39428ac961b7260d27fcd457ab0787bb4eaef4c6c2a8eb17bf15ee436d9b83f2737776ce9c8318d61
7
- data.tar.gz: 109dc23dd6c225f0d0006afc7bf89d3ec49eb52e62003f4ab969979665d525fcd78e96ac2d9f1120175f1dc61d7102278a1db3c5ae867f6463ab42f8e90f012a
6
+ metadata.gz: 77948de2c46b5cd16f33a8c44fff0c8cecf6701802a0c33d68619cea5daeb061d7a1f7d6ace4ec0ff4a321d5d3daf780f9808766edd552915f6277133c8340e4
7
+ data.tar.gz: a3753a90fe4251eb673b72c072367ba6af4b1ed164ef4243288abe3dc43233bc0b059db866a4084ebb8d1cd79adc2b2212a532b3902a43b65ac4a8e337b7d22e
data/exe/prick CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  #$LOAD_PATH.unshift "/home/clr/prj/shellopts/lib"
4
4
  #$LOAD_PATH.unshift "/home/clr/prj/pg_graph/lib"
5
+ #$LOAD_PATH.unshift "/home/clr/prj/fixture_fox/lib"
5
6
 
6
7
  require 'bootsnap'
7
8
  begin
data/lib/builder/batch.rb CHANGED
@@ -134,9 +134,11 @@ module Prick
134
134
  delete = builder.clean ? :none : :touched
135
135
  begin
136
136
  conn.execute fox.to_sql(format: :exec, delete: delete)
137
+
138
+ # FIXME: Why only in FoxBatch - should be set higher up in the system
137
139
  conn.execute "update prick.versions set built_at = now() at time zone 'UTC'"
138
140
  rescue PG::SyntaxError, PG::Error => ex
139
- raise PostgresError, "prick: #{error} from #{node.path}"
141
+ raise PostgresError, "prick: #{ex.message}"
140
142
  end
141
143
  }
142
144
  t_type.emit
@@ -93,7 +93,6 @@ module Prick
93
93
  def execute(conn, create_schemas: schemas)
94
94
  group if batches.nil?
95
95
  conn.exec create_schemas.grep_v("public").map { |schema| "create schema #{schema}" }
96
- conn.schema.create("public", authorization: "postgres")
97
96
  for batch in batches
98
97
  batch.execute
99
98
  end
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.20.14"
4
+ VERSION = "0.20.17"
5
5
  end
@@ -7,7 +7,9 @@ module Prick::SubCommand
7
7
  Timer.on! if timer
8
8
  time "Prick::Command#build" do
9
9
  begin
10
- super_conn = PgConn.new
10
+ super_conn = PgConn.new # Used to create new databases (doesn't make a
11
+ # difference right now as the mikras user is
12
+ # still a superuser)
11
13
 
12
14
  conn = nil
13
15
  builder = nil
@@ -18,30 +20,36 @@ module Prick::SubCommand
18
20
  else
19
21
  super_conn.rdbms.create database, owner: username
20
22
  conn = PgConn.new(database, username)
21
- exit = false
23
+ exist = false
22
24
  end
23
25
 
24
26
  builder = Prick::Build::Builder.new(conn, builddir)
25
27
 
26
28
  if exist
27
29
  if force
28
- builder.schemas.each { |schema| conn.schema.drop schema, cascade: true }
30
+ # Drop all schemas but re-creates the public schema
31
+ super_conn.rdbms.empty!(database)
29
32
 
30
33
  else
31
- # Explicit schema is always rebuilt
32
- refresh = [builder.refresh_schemas, schema].compact.flatten.uniq
33
- keep = builder.keep_schemas.reject { |s| s == schema }
34
+ # Find schemas to refresh. This includes all schemas in the
35
+ # database
36
+ refresh_schemas = conn.schema.list
34
37
 
35
- # Rebuild non-existing keep-schemas
36
- keep.reject! { |schema|
37
- refresh << schema if !conn.schema.exist?(schema)
38
- }
38
+ # Find existing keep-schemas
39
+ keep_schemas = builder.keep_schemas.select { |s| conn.schema.exist?(s) }
40
+
41
+ # Remove keep-schemas from list of schemas
42
+ refresh_schemas -= keep_schemas
39
43
 
40
44
  # Eliminate keep schemas from build pool
41
- builder.pool.delete_schema(keep)
45
+ builder.pool.delete_schema(keep_schemas)
42
46
 
43
47
  # Drop refresh schemes
44
- refresh.each { |schema| conn.schema.drop(schema, cascade: true) }
48
+ refresh_schemas.each { |schema| conn.schema.drop(schema, cascade: true) }
49
+
50
+ # Re-create public schema
51
+ conn.schema.create("public", authorization: "postgres")
52
+ conn.exec "grant usage, create on schema public to public"
45
53
  end
46
54
  end
47
55
 
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.20.14
4
+ version: 0.20.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-19 00:00:00.000000000 Z
11
+ date: 2022-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic