laravel php artisan migrate does not create a new table

703

I have created a user migration and then created the table. Here is the command:

php artisan migration:make create_users_table --table=users --create

And then I updated the schema for my desired fields, and ran this command:

php artisan migration

And it works and created the table with all of its field.

Then I again typed the following command to create a new table's schema for comments table"

php artisan migration:make create_comments_table --table=comments --create

And it worked.

And I updated the actual schema of the table, but then when I commanded php artisan migrate it throws an error:

Base table or view already exists. table 'users' ....

Why? because I'm creating the comments table, what it has to do with users table.

192

Answer

Solution:

To avoid problems, try creating the tables like these

php artisan migrate:make create_users_table --table=users --create=users

php artisan migrate:make create_comments_table --table=comments --create=comments

taking note of the arguments in--create for each cli command.

716

Answer

Solution:

php artisan migrate:make create_comments_table --table=comments --create

The --table and --create options may also be used to indicate the name of the table, and whether the migration will be creating a new table

migrations

People are also looking for solutions to the problem: php - Yii: Blocks of required form data

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.