pg_spec_helper 1.9.10 → 1.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18c3f281f5220ac541ecdff460921d5256d698cde0dfabb9a5522802b9c99cb3
4
- data.tar.gz: 45a6ad92ec2637d058ae2978572464e25b3f9153ef543671f49b532a11fc1b3d
3
+ metadata.gz: 05407ffbeaaecf32054b8058325079e85e466a27c0caf79607a13844b2cb4353
4
+ data.tar.gz: '079c652b019f5e61536c26fd1b05cc0fa81ec69847fa0305194a864bd9203a07'
5
5
  SHA512:
6
- metadata.gz: f071cc5f3bda777b7673346cb916230a65375ccb29d1496a106cc2b37d1c18de2be388c59991e144891c67d09156e19c9c64cc90e5e1150ec8fbe019f545a1ca
7
- data.tar.gz: b12991673a455dc4bbded79ffe4e222b8322295aa57468d68634ceaf7d4db746a90fd588a31e5966276889835ad2c2bd88ef95e0887dc15db11c76783889aa63
6
+ metadata.gz: ec42ef083b0c843178a8cde8c8be08bf47efe4503a36d780a3979e1c9421b142e4517523aba35a5eae1b4df4c886abb1d46ccbeb9e0e6b6ad5eb372d5664fe6c
7
+ data.tar.gz: b992a3bf513f94ca851c7131398b529301c061e0a58336129bf9061f184deeeccf71070e8aa642a5056d81dab6d6cf404728df00b4a3144d4f8ef9584a959230
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.12](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.11...v1.9.12) (2023-10-09)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * accepting both `database` and `dbname` as the name of the database and both `user` and `username` as the name of the user. This covers the naming conventions from both the PG gem and ActiveRecord. ([2f43555](https://github.com/craigulliott/pg_spec_helper/commit/2f435555e1789ecd002f4c22b4feb6f4d2b8cb56))
9
+
10
+ ## [1.9.11](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.10...v1.9.11) (2023-09-01)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * automatically add the citext extension if a column requires it ([0282269](https://github.com/craigulliott/pg_spec_helper/commit/028226916532ec135c47fe59540f556203d9964f))
16
+
3
17
  ## [1.9.10](https://github.com/craigulliott/pg_spec_helper/compare/v1.9.9...v1.9.10) (2023-08-25)
4
18
 
5
19
 
@@ -7,6 +7,17 @@ class PGSpecHelper
7
7
 
8
8
  # create a column for the provided table
9
9
  def create_column schema_name, table_name, column_name, type, null = true, default = nil
10
+ # required extension for citext
11
+ if type.to_sym == :citext
12
+ connection.exec(<<~SQL)
13
+ -- temporarily set the client_min_messages to WARNING to
14
+ -- suppress the NOTICE messages about extension already existing
15
+ SET client_min_messages TO WARNING;
16
+ CREATE EXTENSION IF NOT EXISTS "citext";
17
+ SET client_min_messages TO NOTICE;
18
+ SQL
19
+ end
20
+
10
21
  # note the `type` is safe from sql_injection due to the validation above
11
22
  connection.exec(<<~SQL)
12
23
  ALTER TABLE #{connection.quote_ident schema_name.to_s}.#{connection.quote_ident table_name.to_s}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class PGSpecHelper
4
- VERSION = "1.9.10"
4
+ VERSION = "1.9.12"
5
5
  end
@@ -53,17 +53,23 @@ class PGSpecHelper
53
53
 
54
54
  attr_reader :database, :username, :password, :host, :port
55
55
 
56
- def initialize database:, username:, host:, port:, password: nil
56
+ def initialize host:, port:, database: nil, dbname: nil, user: nil, username: nil, password: nil
57
+ # for simplicity, we accept both `database` and `dbname` as the name of the database
58
+ # and both `user` and `username` as the name of the user
59
+ # this covers the naming conventions from both the PG gem and ActiveRecord
60
+ provided_database = dbname || database
61
+ provided_username = user || username
62
+
57
63
  # assert that all required options are present
58
- raise MissingRequiredOptionError, "database is required" if database.nil?
64
+ raise MissingRequiredOptionError, "database is required" if provided_database.nil?
59
65
  raise MissingRequiredOptionError, "host is required" if host.nil?
60
- raise MissingRequiredOptionError, "username is required" if username.nil?
66
+ raise MissingRequiredOptionError, "username is required" if provided_username.nil?
61
67
 
62
68
  # record the configuration
63
- @database = database
69
+ @database = provided_database
64
70
  @host = host
65
71
  @port = port || 5432
66
- @username = username
72
+ @username = provided_username
67
73
  # password is optional
68
74
  @password = password
69
75
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.10
4
+ version: 1.9.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-25 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg