migration:fresh seems like a very phuckin stupid idea?

Posted 1 month 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.