Contact Label Migration Rollback

Asked 2 years ago, Updated 2 years ago, 30 views

Hi, everyone. I'm doing this and that because I'm practicing migration, I'm asking you because there's something I don't understand because I'm trying to create a todos table and add a column with the artisan make: command.

Below are the steps you actually worked on.

// column additional migration file
class AddColumnTodosTable extends Migration
{
    public function up()
    {
        Schema::table('todos', function (Blueprint $table) {
            $table->string('title');
        });
    }

    public function down()
    {
        Schema::table('todos', function (Blueprint $table) {
            $table->drop('title');
        });
    }
}

We confirmed that additional column migration will be rolled back by rolling back, but the todos table disappeared. I don't know the cause, but was the down method written incorrectly? Below is a captured image of the above. I ask for your help me. <

laravel

2022-09-22 20:22

1 Answers

It's not accurate because I don't use migration often In the manual,

$table->dropColumn('title');

https://laravel.kr/docs/5.3/migrations

It looks like this.

And

php artisan migrate:refresh --step=1

You can also specify steps like this.

The batch field in the migrations table created by the label seems to be referenced to proceed with the step.

I'd like you to refer to these two.


2022-09-22 20:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.