Yii_Env For Console Commands?

Just tried to run a migration, but it seems like it picked up my production config instead of staging. Looking through the code, there’s no YII_ENV explicitly set so it defaults to “prod”.

What’s the proper way to set YII_ENV for console commands? For now, I just hacked the @app/yii file directly.

defining it in the @app/yii file is just how you do it. set the constant before loading yii so yii will not take the default but your value.