skip to Main Content

I’m just starting out with my Laravel project for a subject I have on uni and so far I’ve been transferring my whole project between those two PCs without any issues, but last time I tried out migrations something interesting happened.

On my laptop at home everything went through fine, it migrated to phpMyAdmin and I saw the columns having the right values for modifiers. When I transferred the next day my project to uni I saw that when I tried to migrate it suddenly gave me a few (easily fixable) errors. Things like string length being too long or description type column not being able to have a default value like I defined.

So my question is: What could be the issue for my project at home not showing those errors, when the exact same project at uni doesn’t let me migrate before I fix it all? I work in the same IDE on both PCs (PhpStorm – same version, same account) and both Laravel versions are 6.6.0.

I just want to be sure that I’m not doing mistakes and I can fix my errors at home, not in front of my teacher while giving it to grade it.

Thanks for help

Edit:

Those two lines for example are the ones causing problems on my uni pc, yet at home it goes through without any problems. The error I get are just simple things, something like “key value too long” (for the name column) or “no default value allowed for description type columns”

$table->string('name',200)->unique();
$table->text('description')->nullable(true)->default('No description.');

2

Answers


  1. Sounds like you have different PHP or Apache/Nginx versions installed with different configurations, maybe even showing notices for development state. You should try to set up the same server side configuration or consider to use Docker that works across devices as a container system.

    Login or Signup to reply.
  2. Edit file app/Providers/AppServiceProvider.php inside the boot method change it to:

    use IlluminateSupportFacadesSchema;
    
    public function boot()
    {
        Schema::defaultStringLength(191);
    }
    

    For more information, go to this thread https://laravel-news.com/laravel-5-4-key-too-long-error

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search