nnjeim / world

A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.
MIT License
761 stars 104 forks source link

Publishing Command Doesn't Publish the Migration Files #14

Closed ahmadyousefdev closed 2 years ago

ahmadyousefdev commented 2 years ago

Describe the bug When I executed the command php artisan vendor:publish --tag=world I got this message

Copied File [/vendor/nnjeim/world/config/world.php] To [/config/world.php]
Copied File [/vendor/nnjeim/world/src/Database/Seeders/WorldSeeder.php] To [/database/seeders/WorldSeeder.php]
Copied Directory [/vendor/nnjeim/world/resources/lang] To [/resources/lang/vendor/world]
Publishing complete.

As you can see, no migration files have been published. I don't know if it's a bug or do you store the data in a json file or do they generate when you execute the seed file, can you please explain? because what I found in the readme is that there are tables, but I can't find any when publishing the files.

Expected behavior publishing the migration files?

Screenshots

Screen Shot 2022-03-05 at 13 33 35

Thank you 😄

nnjeim commented 2 years ago

@ahmadyousefdev hi Ahmed, as you clearly mentioned the migrations are never published but only called when you run php artisan db:seed in the console. please look at Nnjeim\World\WorldServiceProvider. The installation of the package starts by running php artisan migrate. The seeding is calling the data from the json files. The lang files, the config file (world.php) and the WorldSeeder are only published. At this stage i don't see a reason why would we publish the migrations if they are called only once. In the upcoming release we will consider a dynamic migrations structure where the user can choose which fields he wants to include from the the json source.

ahmadyousefdev commented 2 years ago

Thank you for the clarification, it's all clear now. I will look forward for the upcoming releases, it's better imo to have dynamic migrations. :)