简体   繁体   中英

laravel 5.4 migration issue

I am having a very weird issue when running

php artisan migrate

on a new installation of Laravel 5.4 on a local XAMPP server with php 7.1.1.

What it is doing is creating a migrations and users table, the default tables in older versions of Laravel. What is should be creating is a users table and a passwords reset table, the new default tables. My env file is correct because I am connecting to the database correctly but then if I change the table I am connecting to in the env file it is not updating.

To me, it seems like the command is simply not running on the correct migrations folder in the application. This is a brand new machine with a fresh install of XAMPP and Laravel so I am very confused as to why this is happening. Any help would be much appreciated!!!

I was finally able to get this to work so I wanted to answer the question to explain what I did.

This first step may not be required for you but it was for me. Once again, here is what I was using: Laravel 5.4 on a local XAMPP server with php 7.1.1

-First I needed to edit app>Providers>AppServiceProvider.php https://laravel-news.com/laravel-5-4-key-too-long-error -Add this line to the top, under the other use include: use Illuminate\\Support\\Facades\\Schema; -In the boot() function add this code: Schema::defaultStringLength(191);

-After that I needed to run php artisan migrate , to create the default tables from the migrations. For some reason, a reason I could not find with any amount of research, this creates the old tables from an unknown source. After that I needed to edit the create_users_table migration, delete the users and migrations table that were created in the database, then rerun php artisan migrate . Like I said, I am not sure why this has to be done but it will get it to work.

Also, remember to run these commands before running php artisan migrate the last time just to be safe:

php artisan cache:clear

php artisan config:cache

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

php artisan migrate:refresh php artisan migrate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM