phinx
phinx copied to clipboard
warning no environment specified, defaulting to: development
The docs seems outdated.
My config looks like this:
environments:
default_migration_table: phinxlog
default_environment: development
But I get a warning: warning no environment specified, defaulting to: development
.
How to properly set default_environment
?
The warning is expected if you don't pass --environment
to the command, to indicate that it's using the value from default_environment
. The only potential change here would be reducing this from a warning to an info message, but this is (to my knowledge) the first time anyone's commented about it being a warning.
I see that now, maybe change the wording to something like "--environment command not specified, using default_environment from config
".
I guess it's not a big deal but initially it looked like it's warning my config file is not properly configured:
Yeah, all the commands that take an environment option all have the same output if it's omitted:
https://github.com/cakephp/phinx/blob/5c28445848a1daba6883dd94f77c0feef0db3d28/src/Phinx/Console/Command/Migrate.php#L76
Looking at git history, it's also been like this since the project's creation 13 years ago.
I think having it be a warning could be useful where in production, where you are expected to use the --environment production
flag and if you omit it, you'd want a stronger visual indication that you did that, vs just a comment that's more likely to blur into the rest of the output.
As a middle ground, would updating the docs to indicate that if you omit the environment flag, then a warning will be shown and phinx will use the value of default_environment
have helped explain what was going on?
To be clear, I don't have a strong opinion about this one way or the other.
As a middle ground, would updating the docs to indicate that if you omit the environment flag, then a warning will be shown and phinx will use the value of default_environment have helped explain what was going on?
I guess that's better but TBH I didn't fully read the docs lately, though I have been using phinx for years. Somehow this warning caught my attention in my latest project.
I think the confusion is due to the warning doesn't state where it arises from -- whether its from cmd line flag or config file. I don't usually use --environment
flag so to me I thought phinx only sees the config file. Again it's not really a big deal now that I understand it.
On a side note, the docs still says default_migration_table
but I think that's deprecated since 0.13
.