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 +4 -4
- data/lib/pg_conn/rdbms_methods.rb +5 -5
- data/lib/pg_conn/schema_methods.rb +2 -2
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c6b35126469d1a4c72a3ecdfe32502266eefce16574d91f0b00b9c969b586f8
|
4
|
+
data.tar.gz: ad15bf23023dad7d1a41716c7d3587e0b27400c4fee41bb3870f692adef9e908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
39
|
-
#
|
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
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
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.
|
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-
|
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.
|
109
|
+
rubygems_version: 3.1.2
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Gem pg_conn
|