Laravel php artisan migrate not working Laravel php artisan migrate not working sqlite sqlite

Laravel php artisan migrate not working


I had the same results, in my case the /database/database.sqlite file was not empty.

I deleted the contents reran php artisan migrate and the migration table was created successfully.


Running Laravel in Windows under the Powershell console I was getting the same errors as the original poster. The documentation reads After creating a new SQLite database using a command such as touch database/database.sqlite... The Powershell equivalent of touch is typically Out-File FILENAME

PS D:\Learning\PHP-Laravel\database> out-file database.sqlitePS D:\Learning\PHP-Laravel> php artisan migrate   Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 26 file is not a database...

When creating my database.sqlite file I received these errors. I deleted the database and recreated it using the New-Item command and it worked properly

new-item -ItemType File -Name database.sqlitePS D:\Learning\PHP-Laravel> php artisan migrateMigration table created successfully.


Check the file you made as .sqlite and make sure it is empty if not then make it empty

database/db.sqlite 

then run migration