From d2306666cc016ca04d0edca1a48cd976555de136 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Sat, 18 Jan 2025 16:38:21 -0500 Subject: [PATCH] Restore MySQL connection to the registry A bug introduced in d17dff9 and shipped in v1.5.0 caused the MySQL engine to connect to the target database instead of the registry database. Restore connecting to the registry database. Resolves #862. --- Changes | 5 ++++- lib/App/Sqitch/Engine/mysql.pm | 2 +- t/mysql.t | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 7b43cf37..4c36ca4c 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,9 @@ Revision history for Perl extension App::Sqitch -1.5.1 Note yet released +1.5.1 Not yet released + - Fixed a bug introduced in v1.5.0 where the MySQL engine connected to + the target database instead of the registry database. Thanks to + @tiberiusferreira for the report (#862)! 1.5.0 2025-01-08T03:22:40 - Fix improperly nested Pod headers that were incrementing two levels diff --git a/lib/App/Sqitch/Engine/mysql.pm b/lib/App/Sqitch/Engine/mysql.pm index 219d78db..253b95d9 100644 --- a/lib/App/Sqitch/Engine/mysql.pm +++ b/lib/App/Sqitch/Engine/mysql.pm @@ -65,7 +65,7 @@ sub _def_user { $_[0]->_mycnf->{user} || $_[0]->sqitch->sysuser } sub _def_pass { $ENV{MYSQL_PWD} || shift->_mycnf->{password} } sub _dsn { - (my $dsn = shift->uri->dbi_dsn) =~ s/\Adbi:mysql/dbi:MariaDB/; + (my $dsn = shift->registry_uri->dbi_dsn) =~ s/\Adbi:mysql/dbi:MariaDB/; return $dsn; } diff --git a/t/mysql.t b/t/mysql.t index d3ab5d66..cb946fe0 100644 --- a/t/mysql.t +++ b/t/mysql.t @@ -62,7 +62,7 @@ my $sqitch_uri = $uri->clone; $sqitch_uri->dbname('sqitch'); is $mysql->registry_uri, $sqitch_uri, 'registry_uri should be correct'; is $mysql->uri, $uri, qq{uri should be "$uri"}; -is $mysql->_dsn, 'dbi:MariaDB:database=mydb', 'DSN should use MariaDB'; +is $mysql->_dsn, 'dbi:MariaDB:database=sqitch', 'DSN should use MariaDB'; is $mysql->registry_destination, 'db:mysql:sqitch', 'registry_destination should be the same as registry_uri'; is $mysql->_lock_name, 'sqitch working on ' . $uri->dbname,