prick 0.13.0 → 0.14.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: da40d1823b2163a2ce84de52d2a41aa222ae87afc6bb7cbe22e2d5045a162fba
4
- data.tar.gz: cee09b71589069b2dbe386afec271ef1677980e0e6d6735462a8c087338e71d9
3
+ metadata.gz: c155692c268326430a0e9225d4a7c156fedd52533114b62fae7e7ce61da01177
4
+ data.tar.gz: 4e245212208c3ecc518f313cd9f1af709db5ce41b7281c7247a1078293c486de
5
5
  SHA512:
6
- metadata.gz: 1b8f5f478092b60b5745983d911f37e516b24957bcdd978157e97263d97c65857e71b1335dc10a7f38fdd742f27c62f4cd28071e4ff31f53cca4f51e88f55557
7
- data.tar.gz: 7a3efb1a894edfa8b5ca82688b4820126f2898f2448a92d84af49e611b9156bfbf20f34e62deb605ca50cb9fbb57691d6e2ceae2d604fbb6bb6dc3166e751213
6
+ metadata.gz: 38ff771885f6a73a20f36985403cb61a63fc2f025c20f92bb1dea4cb2ba047f908e48c4a564a50b707594d32199a87f796e0640135f6f0da5a521fe572c70cdb
7
+ data.tar.gz: 79641d89e168fe1be4d7493aed420fd40cd71cfb29ac98c359c34f82457bd1b7c265883e83cf661c29ff1ea6437bf1a087a652987409221cc4c439768b480922
@@ -59,7 +59,23 @@ module Prick
59
59
  @version = nil
60
60
  end
61
61
 
62
- def clean() recreate end # TODO: Find solution that doesn't involve dropping the database
62
+ # Hollow-out a database without dropping it. This is useful compared to a
63
+ # simple drop database since it wont block on other sessions wont block
64
+ def clean()
65
+ if exist?
66
+ schemas = Rdbms.select_values(
67
+ "postgres",
68
+ "select nspname from pg_namespace where nspowner != 10")
69
+ for schema in schemas
70
+ Rdbms.exec_sql(name, "drop schema \"#{schema}\" cascade")
71
+ end
72
+ Rdbms.exec_sql(name, "drop schema if exists public cascade")
73
+ Rdbms.exec_sql(name, "create schema public authorization postgres")
74
+ Rdbms.exec_sql(name, "grant usage, create on schema public to public")
75
+ else
76
+ create
77
+ end
78
+ end
63
79
 
64
80
  def to_s() name end
65
81
  end
data/lib/prick/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Required by gem
6
6
  module Prick
7
- VERSION = "0.13.0"
7
+ VERSION = "0.14.0"
8
8
  end
9
9
 
10
10
  # Project related code starts here
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.13.0
4
+ version: 0.14.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: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shellopts