Laravel's Artisan says nothing to migrate

laravel download
laravel framework tutorial
laravel logo
laravel github
laravel 6
laravel framework github
laravel latest version
laravel 7

I installed migrations with php artisan migrate:install then created a migration with the php artisan migrate:make create_teams_table command. Now I try to run them with the following command that I made according to the official documentation:

php artisan migrate --path=app/foo/migrations/2014_01_21_143531_create_teams_table.php

This gives me the following on the console:

Nothing to migrate.

The migrations table in the database is empty and the new table isn't created neither. I don't understand why the documentation says foo in the path. What does foo mean and where does it comes from? First I tought that the path is wrong because of the foo thing and as I know the path is relative to the app folder so I changed it to app/database/migrations but it doesn't work. I also tried a lot of other path combination but none of them worked.

Did I entered the wrong path? In this case shouldn't the console show some other kind of helpfull message? What does foo mean? How can I run my migration?

That foo thing is just an example. Laravel will look for migrations to run in app/database/migrations on default. Try removing that --path parameter and see if it works.

laravel/laravel: A PHP framework for web artisans, Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly  Laravel is a powerful MVC PHP framework, designed for developers who need a simple and elegant toolkit to create full-featured web applications. Laravel was created by Taylor Otwell. This is a brief tutorial that explains the basics of Laravel framework.

Try this:

First:

php artisan migrate:reset

Rolled back: 2014_03_28_142140_user_table

Nothing to rollback.

second:

php artisan migrate

Migrated: 2014_03_28_142140_user_table

check the database.

laravel/framework, About Laravel. Note: This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main Laravel  Laravel 1 included built-in support for authentication, localisation, models, views, sessions, routing and other mechanisms, but lacked support for controllers that prevented it from being a true MVC framework. Laravel 2 was released in September 2011, bringing various improvements from the author and community.

The path argument is for creating a migration for example:

 php artisan migrate:make create_user_table --path=app/database/migrations/user_migrations/

But it is not documented to use while running the migrations, as it was in prior versions of laravel.

Dropping the --path argument should work in your case

Laravel, Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the  Laravel tutorial provides basic and advanced concepts. Our Laravel tutorial is designed for beginners and professionals. Laravel is an open-source PHP framework. It also offers the rich set of functionalities that incorporates the basic features of PHP frameworks such as Codelgniter, Yii, and other programming languages like Ruby on Rails.

What helped me:

php artisan config:cache
php artisan migrate

Laravel, Laravel is a PHP framework for constructing everything from small to enterprise-​level applications. As you'll find, it's a joy to use, and just might make you love  About Laravel. Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: Simple, fast routing engine. Powerful dependency injection container.

You don't need to move the migration file anywhere, just change its filename; for example, increase time integer and then run the migrate command with path pointing the migration. e.g: php artisan migrate --path="database/migrations/2019_07_06_145857_create_products_table.php"

Laracasts Journey: Laravel, Laravel News is the official blog of Laravel. Every day bringing you the latest news, tutorials, and packages for the framework. In this tutorial, you will learn about Laravel - which is an open-source framework. Required Knowledge. It is essential to understand the concepts of PHP and MySQL before learning Laravel. Knowledge about any PHP framework like Codeigniter will help you understand Laravel quickly.

Laravel News, Laravel offers a rich set of functionalities which incorporates the basic features of PHP frameworks like CodeIgniter, Yii and other programming languages like  Laravel 7 is now released and includes many new features including Laravel Airlock, better routing speed, custom Eloquent casts, Blade component tags, fluent string operations, a new HTTP client, CORS support, and many more features.

Laravel - Overview, About Laravel. Note: This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main Laravel repository. Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling.

Laravel PHP Framework Tutorial, Start Developing With PHP For Free. Courses Led By Experts, No Previous Skills Required. Try It Free For 7 Days. From Beginner To Career-Ready.

Comments
  • if you keep your migrations in app/database/migrations, you should be able to ignore the path parameter entirely
  • Shouldn't that run all the migrations? I need to run only the last one because the project has a lot of older ones that are now wrong.
  • The thing about migrations is that they are supposed to work as a batch. You should be able to run php artisan migrate:refresh without any troubles. So with that in mind, I would say remove/move those broken ones and keep the nice ones.
  • Oh, I just realized that I mixed up the chapters in the documentation. I tought I can run a specific migration by passing the path, but it was actually the migration creation example. What a fail.
  • Turning it off and on always works ! :)
  • This is quite similar with what is tried in the example.