Minion::Backend::Pg: Postpone migrations to first connection #1886
Unanswered
augensalat
asked this question in
Q&A
Replies: 2 comments 14 replies
-
This is incorrect, |
Beta Was this translation helpful? Give feedback.
6 replies
-
Then perhaps they shouldn't initialize Mojo::Pg?
Just as an example, initialize if app->mode eq production, but if mode eq
cli, don't.
Of course mode is not the best condition to base this on, but it
illustrates the point. Environment variable? Config value? I'd think
there's some way for a command to influence the startup of the application,
but I can't think of the most ideal at the moment.
…On Fri, Nov 19, 2021, 12:26 PM Bernhard Graf ***@***.***> wrote:
OK. Maybe I'm wrong and the migration is not loaded there.
But the constructor connects to the database server to determine the
server version. This is still a problem for the commands that do not
have/need database access.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1886 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD6K6Q3D5ZFARLRNJH2BMLUM2JFRANCNFSM5IMUNCRQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After switching from
Minion::Backend::mysql
toMinion::Backend::Pg
I have issues with application commands:The constructor of
Minion::Backend::Pg
tries to run its migrations as soon it is instantiated - this seems to be the case if you havein your application class.
As a consequence migrations are tried even when a simple
Mojolicous::Command
is executed by an application, i.e.This command fails when the database - which is not required for the command - is not accessible. OTOH the migration is always tried if the database can be reached, which is not always desired, and slows down the commands in any case.
In a project based on Mojolicious we use a couple of dev commands in the
Author
namespace (i.e. for CI/CD) that don't have and don't need access to the database. This fails now.Currently I'm not aware of a way to find out in the application code by which
Mojolicous::Command
it was started in order to conditionally skip the Minion-plugin loading. Even then it would be a clumsy work-around.As indicated I did not have these issues with
Minion::Backend::mysql
that postpones migration to the first database connection event. I would really appreciate IfMinion::Backend::Pg
would do that in the same way.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions