migration:fresh seems like a very phuckin stupid idea?

Posted 5 months ago by behnampmdg3

Someone enlighten me, please!

Let's say there is an update required to one of your table structures.

For example rename column from email to email_address.

Jeff says you can use migration:fresh which drops everything and does it again! That will delete all the data!

It would make sense to make a new migration and migrate without losing all the data.

php artisan make:migration update_email_users_table --table=users

And in it

public function up()
    {
        Schema::table('my_users', function (Blueprint $table) {
             $table->renameColumn('from', 'to');

        });
    }

What am I missing? Why even mention such a dangerous command migration:fresh?

I am not a robot.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.