-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database seeder throws error #8
Comments
In case anybody else wants to use fake data for testing, activating all databse seeds won't work at the moment because of either student_id or teacher_id must not be NULL. This is the setup that helped me to get as much data as possible without any errors: class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->call(SchoolsTableSeeder::class);
$this->call(ClassesTableSeeder::class);
$this->call(SectionsTableSeeder::class);
$this->call(UsersTableSeeder::class);
// $this->call(AttendancesTableSeeder::class);
$this->call(SyllabusesTableSeeder::class);
$this->call(NoticesTableSeeder::class);
$this->call(EventsTableSeeder::class);
$this->call(FeesTableSeeder::class);
// $this->call(HomeworksTableSeeder::class);
$this->call(RoutinesTableSeeder::class);
// $this->call(NotificationsTableSeeder::class);
$this->call(ExamsTableSeeder::class);
$this->call(GradesystemsTableSeeder::class);
// $this->call(CoursesTableSeeder::class);
// $this->call(GradesTableSeeder::class);
// $this->call(FeedbacksTableSeeder::class);
$this->call(FormsTableSeeder::class);
$this->call(BooksTableSeeder::class);
$this->call(MessagesTableSeeder::class);
$this->call(FaqsTableSeeder::class);
$this->call(IssuedbooksTableSeeder::class);
$this->call(AccountsTableSeeder::class);
$this->call(AccountSectorsTableSeeder::class);
// $this->call(StudentinfosTableSeeder::class);
// $this->call(StudentboardexamsTableSeeder::class);
}
} |
In migrations in 2018_10_08_002853_add_department_class_teacher_to_users_table.php file instead of this:
do this:
|
Applied the fix manually, but when running the migrate:refresh 2x in a row, I get this error:
I can't find any Grammar.php file... |
This fix does not work. Please test with all seeds and run migrate:refresh at least twice and you'll see that there are still troubles. |
@rowild I forgot to uncomment a factory line from user seeder class after a certain test case. Now all my Seedings are working. Please take a look. Now I've updated the it via pull request. |
This issue is solved, so I close it. Thank you, @changeweg. |
If I activate all seeds in
dataabase/seeds/DatabaseSeeder
usingphp artisan migrate:refresh --seed
on an empty DB table, the following errors are thrown:If I run the same command on the same DB table again (meaning the DB has all the tables now), this errors are thrown:
There was a
departments
(plural!) table. It gets remove somewhere at the beginning, when the artisan script starts. I guess that at the time, when theusers
table is called, thedepartments
table does simply not exist anymore...The text was updated successfully, but these errors were encountered: