exwiw 0.4.1 → 0.4.2

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: a743c4759cdb8b292e4fdfe8ea3d4e10fa66e15a70677dd685366fb9e26a376b
4
- data.tar.gz: '04048ceca802c0d418495cdf7c002bd47047beb05a53655a451c2c77a4d8270d'
3
+ metadata.gz: ca52e1b7e6072849c3dccb1ec8b2b80fb261e024891d2ac032406d4ce5726ef4
4
+ data.tar.gz: d54c3eee7c729e02198e2876e9c9cd5de62c893e2a68f10d221051c04d6535cc
5
5
  SHA512:
6
- metadata.gz: 7d7a5ffca1cdae405e88fac5d72e4ed4e52ee3deec8cce0e503dcdc2b4136ec03ca2d84893c5897a3e56a78b0fa9e11dddc5f606566f32c90297815c8ade4702
7
- data.tar.gz: 8e7742f720c371b41679c311d6323f8182e4f414f1ff199ac90928026ce46c2607a61a3c3a7ed91c23c97ea4b855d838bfee38b593d69c06f1dc743a17916eb0
6
+ metadata.gz: e5153e47e7112e8ce324e4b06fb91584a36207a6ffa999ca7b15e5d7ebfe015dcdd38cc41a4f211b59bea5300f36205ca2347058ece6477473c1977b7398ae8a
7
+ data.tar.gz: b545c258a47dbea0c8f992d548fea245bd3bf34fe223e93c82443f0f9cb447c6ef1e833ab21f13061a39a2f34a0050f9d2a8e9e9335e1a25b39b21fd0d0d5c14
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.4.2] - 2026-06-05
6
+
7
+ ### Fixed
8
+
9
+ - MySQL: `mysqldump` no longer fails with `unknown variable 'set-gtid-purged=OFF'` when the client binary is MariaDB's. The adapter detects the variant via `mysqldump --version` and omits the MySQL-specific flag for MariaDB.
10
+
5
11
  ## [0.4.1] - 2026-06-04
6
12
 
7
13
  ### Added
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'open3'
4
+
3
5
  module Exwiw
4
6
  module Adapter
5
7
  class MysqlAdapter < Base
@@ -26,8 +28,6 @@ module Exwiw
26
28
  end
27
29
 
28
30
  def dump_schema(ordered_tables, output_path)
29
- require 'open3'
30
-
31
31
  table_names = ordered_tables.map(&:name)
32
32
  if table_names.empty?
33
33
  File.write(output_path, "-- Auto-generated by exwiw. No tables in scope.\n")
@@ -42,6 +42,10 @@ module Exwiw
42
42
  mysqldump_bin = ENV['EXWIW_MYSQLDUMP']
43
43
  mysqldump_bin = 'mysqldump' if mysqldump_bin.nil? || mysqldump_bin.empty?
44
44
 
45
+ # MariaDB's mysqldump does not recognise the MySQL-specific
46
+ # --set-gtid-purged flag and exits with code 7.
47
+ gtid_flags = mariadb_mysqldump?(mysqldump_bin) ? [] : ['--set-gtid-purged=OFF']
48
+
45
49
  cmd = [
46
50
  mysqldump_bin,
47
51
  "--host=#{@connection_config.host}",
@@ -49,17 +53,9 @@ module Exwiw
49
53
  "--user=#{@connection_config.user}",
50
54
  '--no-data',
51
55
  '--skip-add-drop-table',
52
- # `--skip-comments` only suppresses the dump's header lines
53
- # (e.g. `-- MySQL dump ...`, server version banner). Column and
54
- # table `COMMENT '...'` clauses are emitted inline inside
55
- # CREATE TABLE statements and are NOT affected, so this flag is
56
- # purely about reducing noise in the generated file.
57
56
  '--skip-comments',
58
57
  '--skip-set-charset',
59
- # Suppress `SET @@GLOBAL.GTID_PURGED=...` from the dump. It is intended
60
- # for replication setup and breaks when the target already has GTIDs
61
- # (ERROR 3546: added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED).
62
- '--set-gtid-purged=OFF',
58
+ *gtid_flags,
63
59
  '--compact',
64
60
  @connection_config.database_name,
65
61
  *table_names,
@@ -275,6 +271,18 @@ module Exwiw
275
271
  end
276
272
  end
277
273
 
274
+ private def mariadb_mysqldump?(mysqldump_bin)
275
+ return @mariadb_mysqldump if defined?(@mariadb_mysqldump)
276
+
277
+ @mariadb_mysqldump =
278
+ begin
279
+ version_output, _, status = Open3.capture3(mysqldump_bin, '--version')
280
+ status.success? && version_output.match?(/mariadb/i)
281
+ rescue SystemCallError
282
+ false
283
+ end
284
+ end
285
+
278
286
  private def connection
279
287
  @connection ||= MysqlClient.new(@connection_config)
280
288
  end
data/lib/exwiw/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Exwiw
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exwiw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shia