laravel-csv-seeder
laravel-csv-seeder copied to clipboard
Does not show error message when database throws an error
I got the "Seeded:" message but the csv file was not seeded because of a database error(forgotten to make a column nullable). I wasted lot of time to figure out the error. It would be wonderful it it can throw if there is any database error.
PS: Thanks for providing this library for free. It was really helpful.
Same issue, I struggled above today. But anyway, thanks for the great library!
Shot in the dark
Same for me. Spend an hour to find the bug that caused my tests to fail after a laravel 8 upgrade. The seeds were not working anymore because the seed folder got renamed to "seeders". Please throw an error if the importer can not find the csv file. This is quite easy to implement. At the moment this is only logged https://github.com/Flynsarmy/laravel-csv-seeder/blob/c770b291978fc8680cf68e0fa7b33e1e8690219b/src/CsvSeeder.php#L133
Please throw an error here https://github.com/Flynsarmy/laravel-csv-seeder/blob/c770b291978fc8680cf68e0fa7b33e1e8690219b/src/CsvSeeder.php#L160-L162
@ben182 The problem described in your comment is fixed through https://github.com/Flynsarmy/laravel-csv-seeder/commit/e1774b1b38faa4f380bf5e450d8ecb7db834ec2e
Your comment should have been its own issue as it's different to OPs though.
I don't really like the idea of throwing an Exception on DB error as this may result in the CSV being partially imported which will complicate matters further when a second attempt to import is made.
Do we have any other suggestions?
Maybe an echo output of a warning with some error details could be help nor write of same details to the laravel log files + a note to the cmd line. The current silent fail is the main problem.
Hi,
I'm using version 2.0.5 and it's the first time I try out the package. It's not throwing any error nor importing the data into the database.
I just get a "Seeded:" notice.
I'm using PHP8 with Laravel 8.27.
Has this been fixed in a non-released version?
Thanks in advance.
I don't really like the idea of throwing an Exception on DB error as this may result in the CSV being partially imported which will complicate matters further when a second attempt to import is made.
Do we have any other suggestions?
Make it configurable with a flag to either raise the exception or silently ignore it? Also, seedFromCsv returns $success, but also the run function should return this.
I'm using the CsvSeeder to load test data for development, if the data is invalid (failing database constraints) I would like the seeding process to halt so the issue can be resolved.