artkonekt / user

MIT License
2 stars 5 forks source link

Getting exception while migrating database on profiles migration #1

Closed j-dohnalek closed 5 years ago

j-dohnalek commented 5 years ago

I have issue with migrations after updating to latest version of the user module. I have Laravel 5.8, however I do not use the big increment in my code because of dependencies. I have added the variable to my .env file.

The env(....) in the profile migration always default to true after caching which is throwing exception.

I do not know if this post actually explains why

https://stackoverflow.com/questions/43243732/laravel-5-env-always-returns-null

But is possible to move the assignment of the env(...) out of the profile migration file please?

fulopattila122 commented 5 years ago

Can you do php artisan config:clear at an early stage of deployment and php artisan config:cache at the end of the deployment process?

This Laravel 5.8 bigInt problem is a huge pain in the ass and it's very tricky to solve in another way.

fulopattila122 commented 5 years ago

Maybe you've read it already: https://konekt.dev/user/1.1/installation#laravel-58-and-bigint-compatibility

j-dohnalek commented 5 years ago

True, the shift to 5.8 is a huge pain. Thank you for the answer and resources. I was hoping to propose if there would be a chance to move the code

$useBigInt = env('USER_ID_IS_BIGINT', version_compare(App::version(), '5.8.0', '>='));

from the 2016_12_18_121118_create_profiles_table.php to a configuration, lets say concord.php.

return [
      'modules' => [
            Konekt\AppShell\Providers\ModuleServiceProvider::class => [
                'user_id_is_big_int' => env('USER_ID_IS_BIGINT', version_compare(App::version(), '5.8.0','>=')),

                 // other config
            ],
       ],
];

If the package enables publishing of the config file with vendor:publish would give access to developers to set the value in env without any caching problem, would it not solve the issue?

This is the feeling I get when reading the stackoverflow post, quote: you must make sure that you are only calling the env function from within your configuration files, and not from anywhere else in your application.

Something along line of

$useBigInt = Config::get('concord.modules.' . Konekt\AppShell\Providers\ModuleServiceProvider::class . '.user_id_is_big_int');

would be in the 2016_12_18_121118_create_profiles_table.php

If I have misunderstand how your packages are wired together then apology, yet I would like to know your opinion. Thank you

fulopattila122 commented 5 years ago

Update on the issue: https://github.com/vanilophp/order/pull/4#issuecomment-513159236

j-dohnalek commented 5 years ago

Thank you for the update

fulopattila122 commented 5 years ago

Version 1.2.0 has just been released. A lot of work under the hood, that will likely solve this problem for good: https://konekt.dev/user/1.2/installation#laravel-58-and-bigint-compatibility