pg_conn 0.3.7 → 0.4.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: 589bec28c740660ad6dd0f09101eda54af26aad2f03a43a27ed7ffa6e422fdf3
4
- data.tar.gz: 17ccef8e37a0699331e7c518d1a856652750719dbd2c1a3d04af5173f0d625f5
3
+ metadata.gz: 9c6b35126469d1a4c72a3ecdfe32502266eefce16574d91f0b00b9c969b586f8
4
+ data.tar.gz: ad15bf23023dad7d1a41716c7d3587e0b27400c4fee41bb3870f692adef9e908
5
5
  SHA512:
6
- metadata.gz: 91c48594e61dc7caef44a22de75165f5815e69b4dc2e1b181b024291b5bb7cd3ec9eee97aced702a459424afcc093406af9e6d6cb631b128e8117f0084249ac4
7
- data.tar.gz: d485db7de8dd27c0eb81db8c1d6940f02ba822a88514e6d13999747c55e902121306e1a0c04105be8881dd0f84819f73aa46101432004b22745e2e9848b0d3d6
6
+ metadata.gz: b49f50d2ceb9b87e55d6ae9a076bc477db4e5df474fa291d1c9f03747bb919996b209ec2bf15680651d93b1900f9067690a5653d2e492834348d6c4996b8d2de
7
+ data.tar.gz: 62ad8e07479117796196ff0cf8894a7d4562ab4d6f54eccf826830ba03df0d69897277fb307e7fb0e924e701b8bbe95ea5d81b9b5d0e964b36e879e318e2f11a
@@ -69,13 +69,13 @@ module PgConn
69
69
  end
70
70
 
71
71
  # Hollow-out a database by removing all schemas in the database. The public
72
- # schema is recreated afterwards. Use the current database if @database is
73
- # nil
72
+ # schema is recreated afterwards if :public is true. Uses the current
73
+ # database if @database is nil
74
74
  #
75
75
  # Note that the database can have active users logged in while the database
76
76
  # is emptied
77
77
  #
78
- def empty!(database = nil, exclude: [])
78
+ def empty!(database = nil, public: true, exclude: [])
79
79
  local = !database.nil?
80
80
  begin
81
81
  conn = local ? PgConn.new(database) : self.conn
@@ -84,11 +84,11 @@ module PgConn
84
84
  .values("select nspname from pg_namespace where nspowner != 10 or nspname = 'public'")
85
85
  .select { |schema| !exclude.include?(schema) }
86
86
  .join(", ")
87
+ conn.exec "drop schema #{schemas} cascade"
87
88
  conn.exec %(
88
- drop schema #{schemas} cascade;
89
89
  create schema public authorization postgres;
90
90
  grant usage, create on schema public to public
91
- )
91
+ ) if public
92
92
  ensure
93
93
  conn&.terminate if local
94
94
  end
@@ -35,8 +35,8 @@ module PgConn
35
35
  true
36
36
  end
37
37
 
38
- # List schemas. By built-in schemas are not listed unless the :all option
39
- # is true. The :exclude option can be used to exclude named schemas
38
+ # List schemas. Built-in schemas are not listed unless the :all option is
39
+ # true. The :exclude option can be used to exclude named schemas
40
40
  def list(all: false, exclude: [])
41
41
  conn.values(%(
42
42
  select schema_name
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.3.7"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -582,6 +582,7 @@ module PgConn
582
582
  rescue PgConn::Rollback
583
583
  pop_trancaction(commit: false)
584
584
  return nil
585
+ # FIXME: Rescue other postgres errors and wipe-out stack
585
586
  end
586
587
  pop_transaction(commit: commit)
587
588
  result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_conn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.4.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: 2022-05-08 00:00:00.000000000 Z
11
+ date: 2022-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.1.4
109
+ rubygems_version: 3.1.2
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Gem pg_conn