schema-evolution-manager 0.9.54 → 0.9.55

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: a9ddc3923455520f86e450ced4cbfb288a7988548ae6b30f92cdaa90149fdf18
4
- data.tar.gz: 7cf20d30bb1e013afdb8e455143586c807ee7f2cc6c66e10fdf557f69c8a6a49
3
+ metadata.gz: 13f084ac4b6a9429196469f2b1f52d04167aa443edbe7a65c68a160aab7fc041
4
+ data.tar.gz: 3676fe675b11d5b718b655ac806f66a2986c9745cd63ea52938a030af4a88d22
5
5
  SHA512:
6
- metadata.gz: 9efe8e3b9e596632f79435731ddc16a6b0ce310e1748b172709b8438d82450778fc9cce8aa1f1f880681a45d6b648e7cfd6f2ae0b86f80d53620f87353a52bb2
7
- data.tar.gz: 5d62cf2f42fb940d0a049f611ea21f83b8cab78e1d4a36e7d4003719ae544d1c4e583306b0da64dcf39eb110cb9d65a45fd9b26f8a7baf0a141b507ecb68080e
6
+ metadata.gz: a94a3a279cc858c04637c3e0cb5c9b120699e7fac2091cce7d915bda06761b4eece3fa39c2d76b4d55ec65306ae72977ca204894f130b3a633eb8e331a87c3f5
7
+ data.tar.gz: e7b3d5196adef32e19ed60f58bdcdeed6f377193ddc15f30e44f3a1018325b0ddbf2e4415269645965f24ee4cefa099e36c64cbf77722d5bacfdaed657b565b8
data/README.md CHANGED
@@ -133,7 +133,7 @@ There are three ways to install schema evolution manager:
133
133
 
134
134
  git clone git@github.com:mbryzek/schema-evolution-manager.git
135
135
  cd schema-evolution-manager
136
- git checkout 0.9.54
136
+ git checkout 0.9.55
137
137
  ruby ./configure.rb
138
138
  sudo ./install.rb
139
139
 
data/bin/sem-apply CHANGED
@@ -28,8 +28,8 @@ util = SchemaEvolutionManager::ApplyUtil.new(db, :dry_run => args.dry_run || fal
28
28
 
29
29
  begin
30
30
  db.bootstrap!
31
-
32
- puts "Upgrading schema for #{db.url}"
31
+
32
+ puts "Upgrading schema for #{db.sanitized_url}"
33
33
  count = util.apply!("./scripts")
34
34
  if count == 0
35
35
  puts " All scripts have been previously applied"
@@ -34,8 +34,10 @@ module SchemaEvolutionManager
34
34
  # executes a simple sql command.
35
35
  def psql_command(sql_command)
36
36
  Preconditions.assert_class(sql_command, String)
37
- command = "#{@psql_executable_with_options} --no-align --tuples-only --no-psqlrc --command \"%s\" %s" % [sql_command, @url]
38
- Library.system_or_error(command)
37
+ template = "#{@psql_executable_with_options} --no-align --tuples-only --no-psqlrc --command \"%s\" %s"
38
+ command = template % [sql_command, @url]
39
+ command_to_log = template % [sql_command, sanitized_url]
40
+ Library.system_or_error(command, command_to_log)
39
41
  end
40
42
 
41
43
  def Db.attribute_values(path)
@@ -132,6 +134,37 @@ module SchemaEvolutionManager
132
134
  file.path
133
135
  end
134
136
 
137
+ # Returns a sanitized version of the URL with the password removed
138
+ # to prevent passwords from being logged or displayed in error messages
139
+ def sanitized_url
140
+ # Parse the URL to extract components
141
+ if @url.include?("://")
142
+ protocol, rest = @url.split("://", 2)
143
+ lead, name = rest.split("/", 2)
144
+
145
+ # Check if there's a username:password@ pattern
146
+ if lead.include?("@")
147
+ # Take the last element as host_part to handle passwords with @ symbols
148
+ host_part = lead.split("@").last
149
+ # Take everything before the last @ as user_part
150
+ user_part = lead.split("@")[0..-2].join("@")
151
+
152
+ if user_part.include?(":")
153
+ # Remove password, keep only username (everything before the first colon)
154
+ username = user_part.split(":", 2)[0]
155
+ sanitized_lead = "#{username}:[REDACTED]@#{host_part}"
156
+ else
157
+ sanitized_lead = lead
158
+ end
159
+ "#{protocol}://#{sanitized_lead}/#{name}"
160
+ else
161
+ @url
162
+ end
163
+ else
164
+ @url
165
+ end
166
+ end
167
+
135
168
  end
136
169
 
137
170
  end
@@ -121,9 +121,9 @@ module SchemaEvolutionManager
121
121
  # Runs the specified command, raising an error if there is a problem
122
122
  # (based on status code of the process executed). Otherwise returns
123
123
  # all the output from the script invoked.
124
- def Library.system_or_error(command)
124
+ def Library.system_or_error(command, cmd_to_log=nil)
125
125
  if Library.is_verbose?
126
- puts command
126
+ puts cmd_to_log || command
127
127
  end
128
128
 
129
129
  begin
@@ -13,7 +13,7 @@ module SchemaEvolutionManager
13
13
 
14
14
  def dml
15
15
  sql_command = "insert into %s.%s (filename) values ('%s')" % [Db.schema_name, Scripts::SCRIPTS, @filename]
16
- "psql --command \"%s\" %s" % [sql_command, @db.url]
16
+ "psql --command \"%s\" %s" % [sql_command, @db.sanitized_url]
17
17
  end
18
18
 
19
19
  end
metadata CHANGED
@@ -1,25 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema-evolution-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.54
4
+ version: 0.9.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bryzek
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-18 00:00:00.000000000 Z
10
+ date: 2025-08-25 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: '["Michael Bryzek"]'
14
13
  email: mbryzek@alum.mit.edu
15
14
  executables:
16
- - sem-info
17
- - sem-config
18
15
  - sem-add
19
- - sem-init
20
16
  - sem-apply
21
- - sem-dist
22
17
  - sem-baseline
18
+ - sem-config
19
+ - sem-dist
20
+ - sem-info
21
+ - sem-init
23
22
  extensions: []
24
23
  extra_rdoc_files: []
25
24
  files:
@@ -57,7 +56,6 @@ homepage: https://github.com/gilt/schema-evolution-manager
57
56
  licenses:
58
57
  - Apache-2.0
59
58
  metadata: {}
60
- post_install_message:
61
59
  rdoc_options: []
62
60
  require_paths:
63
61
  - lib
@@ -72,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
70
  - !ruby/object:Gem::Version
73
71
  version: '0'
74
72
  requirements: []
75
- rubygems_version: 3.0.3.1
76
- signing_key:
73
+ rubygems_version: 3.7.1
77
74
  specification_version: 4
78
75
  summary: Schema evolution manager is a simple schema migration tool for postgresql
79
76
  databases.