Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MariaDB: Sqitch doesn't respect registry config anymore #862

Closed
tiberiusferreira opened this issue Jan 18, 2025 · 2 comments · Fixed by #863
Closed

MariaDB: Sqitch doesn't respect registry config anymore #862

tiberiusferreira opened this issue Jan 18, 2025 · 2 comments · Fixed by #863
Assignees

Comments

@tiberiusferreira
Copy link

Hello, previous to #854 sqitch used to respect the registry and use that value as the sqitch schema.

That doesn't seem to be the case anymore. Maybe that was a MySQL specific behavior? If so, could it be replicated for MariaDB?

Example of error:

# On database TestMariaDB
Table 'TestSchema.changes' doesn't exist

With config:

[core]
	engine = mariadb
	registry = sqitch
@theory
Copy link
Collaborator

theory commented Jan 18, 2025

Does it work if the schema exists? Might be that it's not looking in the right place simply because the schema didn't exist when it connected.

@theory
Copy link
Collaborator

theory commented Jan 18, 2025

Oh, I think I know what the issue is. On line 65 of lib/App/Sqitch/Engine/mysql.pm, try changing ->uri to ->registry_uri:

--- 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;
 }
 

@theory theory self-assigned this Jan 18, 2025
theory added a commit that referenced this issue Jan 18, 2025
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.
@theory theory closed this as completed in d230666 Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants