nnjeim / world

A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seed crash after upgrade

marc31 opened this issue · comments

First, things for your greet module.

After minor updating from 1.1.29 to 1.1.30, when I am seeding my db I had an error.

In WorldConnection.php line 14:
Nnjeim\World\Models\Country::getConnectionName(): Return value must be of type string, null returned

It's because I need to add into config/world.php

    /*
	|--------------------------------------------------------------------------
	| Connection.
	|--------------------------------------------------------------------------
	*/
    'connection' => env('WORLD_DB_CONNECTION', env('DB_CONNECTION')),

Can you add it to the changelog.md or make un upgrade.md file to add this kind of change needed after update.

Exemple of file :

Changelog
Version 1.1.30
Added

Added support for specifying the database connection for the World package.
    You can now specify the database connection for the World package in the config/world.php file using the connection key.
    To use the default Laravel database connection, set the WORLD_DB_CONNECTION environment variable in your .env file or directly use the DB_CONNECTION environment variable.

Upgrade Guide
Upgrading from 1.1.29 to 1.1.30
Configuration Changes

After upgrading from version 1.1.29 to 1.1.30, you'll need to make the following configuration change:

Open the config/world.php file.

Add or update the following configuration:

/*
--------------------------------------------------------------------------
 Connection
--------------------------------------------------------------------------
*/
'connection' => env('WORLD_DB_CONNECTION', env('DB_CONNECTION')),

Optionally, if you want to use a specific database connection for the World package, set the WORLD_DB_CONNECTION environment variable in your .env file to the desired connection name.

Thanks

please try to publish the config as below:
php artisan vendor:publish --tag=world --force

I already fix my issue by adding manually to config/world.php

'connection' => env('WORLD_DB_CONNECTION', env('DB_CONNECTION'))

The only think I want is to add some document some where for other people who upgrade.
As a side note maybe is not a minor version change because user need to update their config file if they run composer update.

Indeed if I run php artisan vendor:publish --tag=world --force that fix my but it also override all my conf.

@marc31 Hi Marc, please feel free to update the Readme file if you would like to contribute.
You can add a section titled Upgrading to v1.1.30?
then add your comments so others can avoid having similar issues.

@marc31 I thank you for your contribution. appreciated