user1965074
user1965074

Reputation: 369

Laravel Artisan: Migrate not creating new table

I installed Laravel using composer create-project --prefer-dist laravel/laravel myapp.

I set DB credentials in my .env file.

I proceeded with php artisan make:auth.

Now I am running into issues when I do:

$ php artisan migrate
Migrated: 2014_10_12_000000_create_users_table

This creates a migration table in my DB but not create_users_table in the DB.

I cannot figure out why. Here is some information:

$ php artisan migrate:status
+------+--------------------------------------+
| Ran? | Migration                            |
+------+--------------------------------------+
| Y    | 2014_10_12_000000_create_users_table |
+------+--------------------------------------+

Also I have verified that my (default) migration file looks like this: https://github.com/laravel/laravel.com/blob/master/database/migrations/2014_10_12_000000_create_users_table.php.

I have read that running composer dump-autoload could help. This has not been the case.

The DB user has full privileges.

Any ideas?

Upvotes: 0

Views: 2111

Answers (2)

Andre F.
Andre F.

Reputation: 1163

When you run:

php artisan migrate 

for the first time it will create a migration table within your database. This table will then be filled with all the necessary records that laravel's migration system will reference (Migration file class names inside of your database\migration directory). This migration table will be set to batch_0 and every other migration after will be attached to batch 1...2...3 so on and so forth upon every 'php artisan migrate' command. After which you must run:

php artisan migrate

again (a second time) in order to then populate your database with the appropriate tables. (Update - This applies to Laravel 5.2.31 and prior)

If you run into any problems then the problem is deeper than what you've asked.

Upvotes: 1

MD. ABU TALHA
MD. ABU TALHA

Reputation: 713

please resart your Xampp or Wamp...if it not works..

Then please check the database name, or you can check your working project name in the top of the editor, sometimes we forget to change out project from editor...

or last, you can do composer dump-autoload command

Upvotes: 0

Related Questions