[Dbix-class] SQL::Translator::Producer::MySQL - seems to ignore mysql_version parameter
Chris Welch
welch.chris at gmail.com
Mon Dec 9 16:14:51 GMT 2019
Hi
Firstly, apologies if this is not the correct list, but looking at the
support information for SQL::Translate, it mentions this list...
As a bit of background, I'm trying to get
DBIx::Class::DeploymentHandler up and running with my Catalyst app,
however the database I'm using is MySQL and following the code
through, I don't think SQL::Translator::Producer::MySQL is making use
of the mysql_version parameter. The reason for this is that no matter
what I set this to, any VARCHAR fields with a size of over 255 are
getting corrected to TEXT.
I suspect I'm too much of a novice to check this properly, but I have
mocked up a script that seems to do what
DBIx::Class::DeploymentHandler does and calls SQL::Translator and then
translates from a generated YML file as below:
my $sqlt = SQL::Translator->new({
add_drop_table => 0,
parser => "SQL::Translator::Parser::YAML",
mysql_version => 8,
producer => "MySQL",
});
print $sqlt->translate("$FindBin::Bin/../dbicdh/_source/deploy/1/test.yml");
The test YMLfile contains a single table, as my app contains very much
more than that with a lot of foreign keys, but there are some 300
character VARCHAR characters and some longer; some are only 200, which
work fine, but the longer ones always get converted to TEXT. In fact,
if I set mysql_version to something that should fail, it doesn't - it
just runs and converts those fields to TEXT. I set that value to a
string and - I think - that should die with "Unparseable MySQL version
'$v'", since it seems to call parse_mysql_version in
SQL::Translator::Utils - when I call that manually from my script, I
do get that failure.
I hope this all makes sense... apologies if not, happy to expand on
anything or provide the YML file online somewhere, but I didn't want
to spam the list with unwanted attachments and links, especially if
this is not the right place to ask...
Many thanks in advance.
Chris
More information about the DBIx-Class
mailing list