Skip to content

Improve database seeders to avoid conflicts #52

Description

@quintonpryce

The error that was run into:

vagrant@homestead:~/Code/core$ php artisan db:seed
Seeding: UsersTableSeeder
Seeding: CoursesTableSeeder

                                                                               
  [Illuminate\Database\QueryException]                                         
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'repo  
  sitories/MATH8756/A2/76/' for key 'repositories_path_unique' (SQL: insert i  
  nto `repositories` (`name`, `path`, `backend`, `updated_at`, `created_at`)   
  values (A2, repositories/MATH8756/A2/76/, git, 2017-03-30 17:45:44, 2017-03  
  -30 17:45:44))                                                               
                                                                               

                                                                               
  [PDOException]                                                               
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'repo  
  sitories/MATH8756/A2/76/' for key 'repositories_path_unique'                 
                                                                               

vagrant@homestead:~/Code/core$ php artisan migrate:rollback
Rolling back: 2017_03_15_004119_create_submissions_table
Rolled back: 2017_03_15_004119_create_submissions_table
Rolling back: 2017_03_15_002742_create_assignments_table
Rolled back: 2017_03_15_002742_create_assignments_table
Rolling back: 2017_03_09_015134_create_repositories_table
Rolled back: 2017_03_09_015134_create_repositories_table
Rolling back: 2017_02_15_034244_create_courses_users_table
Rolled back: 2017_02_15_034244_create_courses_users_table
Rolling back: 2017_02_14_204134_create_courses_table
Rolled back: 2017_02_14_204134_create_courses_table
Rolling back: 2014_10_12_100000_create_password_resets_table
Rolled back: 2014_10_12_100000_create_password_resets_table
Rolling back: 2014_10_12_000000_create_users_table
Rolled back: 2014_10_12_000000_create_users_table
vagrant@homestead:~/Code/core$ php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2017_02_14_204134_create_courses_table
Migrated: 2017_02_14_204134_create_courses_table
Migrating: 2017_02_15_034244_create_courses_users_table
Migrated: 2017_02_15_034244_create_courses_users_table
Migrating: 2017_03_09_015134_create_repositories_table
Migrated: 2017_03_09_015134_create_repositories_table
Migrating: 2017_03_15_002742_create_assignments_table
Migrated: 2017_03_15_002742_create_assignments_table
Migrating: 2017_03_15_004119_create_submissions_table
Migrated: 2017_03_15_004119_create_submissions_table
vagrant@homestead:~/Code/core$ php artisan db:seed
Seeding: UsersTableSeeder
Seeding: CoursesTableSeeder
Seeding: RepositoryTableSeeder
vagrant@homestead:~/Code/core$ 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions