pg_conn 0.13.2 → 0.13.4

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: 5a1eb7cce679245ec285129507e3d56948c2239b930ea18a757dd90c2e293404
4
- data.tar.gz: c60efa88bb84530b91a58fd296781052b500968010808f9fa2c3dca4873db772
3
+ metadata.gz: 47d71f26ef9bedde82dfcaf9c196dfde4bf7e016d8865b195687b717972dc5c9
4
+ data.tar.gz: aa0aa1f21ac0a15ae1094bab38ff03b7c9099e08bb5437ed3557a70bf7cc38f4
5
5
  SHA512:
6
- metadata.gz: de7cea3519b5dbd3763c24681ed917ae525fb87e359bc17461e0c950cc70ea47d3c79e230840d878a14533b7921a55384bf17235d32020787e22c37b8fb5e16c
7
- data.tar.gz: 6dde3d8a9ea145db3e28b2467df50333042f3243da9d7b741e1195bb2d17856577541ff8df09744cc94517f9e02c7e6de44eba52fb3ba0ca363d0103edc89d13
6
+ metadata.gz: d9ca49b277657eb5e7ebd9f5a7896168db39ce12b22d7598eb04b39fd9ee8c183fde92adc2c1e2f506ca532a62fd0fda67ec42660843fd74cddd8f6ea2256f0c
7
+ data.tar.gz: '0648150d407460aaf0c5f2f1cb2fdbd6313eed964e72073b2888e4f54cf82af2d96968dd3b7aaa11469620ed459509e948a8fd717ac54284067230702387f0df'
@@ -69,11 +69,12 @@ 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 unless if :public is false. Uses the current
73
- # database if @database is nil
72
+ # schema is recreated afterwards unless if :public is false. Uses the
73
+ # current database if @database is nil
74
74
  #
75
75
  # Note that the database can have active users logged in while the database
76
- # is emptied
76
+ # is emptied. TODO Explain what happens if the users have active
77
+ # transactions. Should the be terminated?
77
78
  #
78
79
  def empty!(database = nil, public: true, exclude: [])
79
80
  local = !database.nil?
@@ -86,7 +87,7 @@ module PgConn
86
87
  .join(", ")
87
88
  conn.exec "drop schema #{schemas} cascade"
88
89
 
89
- # FIXME SECURITY Why grant 'create' to public?
90
+ # FIXME FIXME FIXME SECURITY Why grant 'create' to public?
90
91
  conn.exec %(
91
92
  create schema public authorization postgres;
92
93
  grant usage, create on schema public to public
@@ -102,6 +103,7 @@ module PgConn
102
103
  create(to_database, owner: owner, template: from_database)
103
104
  end
104
105
 
106
+ # TODO: This code is replicated across many project. Should be moved to PgConn
105
107
  def load(database, file, role: ENV['USER'], gzip: nil)
106
108
  command_opt = role ? "-c \"set role #{role}\";\n" : nil
107
109
  if gzip
@@ -116,6 +118,7 @@ module PgConn
116
118
  status == 0 or raise PsqlError.new(stderr)
117
119
  end
118
120
 
121
+ # TODO: This code is replicated across many project. Should be moved to PgConn
119
122
  def save(database, file, data: true, schema: true, gzip: nil)
120
123
  data_opt = data ? nil : "--schema-only"
121
124
  schema_opt = schema ? nil : "--data-only"
@@ -82,7 +82,7 @@ module PgConn
82
82
  # List users. TODO Use RE instead of database argument. Also doc this shit
83
83
  # FIXME: Depends on the <database>__<username> convention
84
84
  def list(database: nil, owner: false, superuser: nil, can_login: nil)
85
- database_clause = database && "rolname like '#{database}__%'"
85
+ database_clause = database && "rolname like '#{database}\_\_%'"
86
86
  database_clause = database && "(#{database_clause} or rolname = '#{database}')" if owner
87
87
  superuser_clause = superuser.nil? ? nil : "rolsuper = #{superuser}"
88
88
  can_login_clause = can_login.nil? ? nil : "rolcanlogin = #{can_login}"
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.13.2"
2
+ VERSION = "0.13.4"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require "pg"
2
2
  require 'ostruct'
3
3
 
4
- require "pg_conn/version"
5
- require "pg_conn/role_methods"
6
- require "pg_conn/schema_methods"
7
- require "pg_conn/rdbms_methods"
8
- require "pg_conn/session_methods"
4
+ require_relative "pg_conn/version"
5
+ require_relative "pg_conn/role_methods"
6
+ require_relative "pg_conn/schema_methods"
7
+ require_relative "pg_conn/rdbms_methods"
8
+ require_relative "pg_conn/session_methods"
9
9
 
10
10
  module PgConn
11
11
  class Error < StandardError; end
@@ -263,7 +263,7 @@ module PgConn
263
263
  # exist?(table, id)
264
264
  # eists?(table, where_clause)
265
265
  #
266
- # Return true iff the query returns exactly one value. Use '!empty?' to
266
+ # Return true iff the query returns exactly one record. Use '!empty?' to
267
267
  # check if the query returns one or more records
268
268
  def exist?(*args)
269
269
  arg1, arg2 = *args
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.13.2
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-15 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.3.18
110
+ rubygems_version: 3.3.7
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Gem pg_conn