I am using version control for my project. After some updates and commit when I run my project again, I have observed that laravel is truncating my Category table.
There are two ways to seed table.
DatabaseSeeder
and with php artisan db:seed
andphp artisan db:seed --class="CategoriesTableSeeder"
I am not able to catch behavior when its truncating my table. I have tested it by commenting all line in the public function run(){}
inside DatabaseSeeder
class and also by commenting DB::table('categories')->insert($categories);
and DB::table('categories')->truncate();
in CategoriesTableSeeder
class.
Because table is getting truncated automatically, I have to seed it again and again.
Any idea???
To solve this problem have gone through all the possibilities. Searched through out the migration files and seed files everything was file. Its already more than 10 days, I was unable to resolve. Gone through the users comments also. But all that did not worked.
One day, I was checking database architecture and I found that engine for categories table was "Memory".
By default I had my database engine set to "InnoDB".
Changed it to "InnoDB" and Problem gone.