0

I have 20 tables in my database. and i want to migrate a new one into the database. But i get the error :

Base table or view already exists: 1050 Table 'house_statuses' already exists.

This table is already in database but everytime i want to migrate something new i got this while this migration already has been migrated earlier.

I see some solutions like yeah Migrate:fresh, But i dont want to remove my records in database because its so much work to set the records back

Bhoomi Patel
  • 777
  • 10
  • 32

2 Answers2

1

If you want to insert more columns in your table you should use the Schema::table, for example:

Let's say you need one more column in your users table, you can simply do that:

Use the command:

php artisan make:migration add_age_to_users_table --table=users
Schema::table('users', function (Blueprint $table) {
    $table->integer('age');
});

And then use:

php artisan migrate

This way your users table will be updated with the new column age

Everytime you want to make a change in your Database you should create a new migration and not edit the last one.

Piazzi
  • 2,490
  • 3
  • 11
  • 25
0

Follow following steps:

  1. Find the file name where you have mentioned to create this table.

  2. Copy file name

  3. Insert file name to migrations table.

It might help you.

Piazzi
  • 2,490
  • 3
  • 11
  • 25
narayansharma91
  • 2,273
  • 1
  • 12
  • 20