Migration change only the default value of a field - Laravel

0

I want to launch a migration that updates only the default value of a field, I tried the following:

 $table->string('mikrotik_rate_limit')->default('1048576/1048576');
 $table->bigInteger('mikrotik_recv_limit')->default(1073741824);
 $table->bigInteger('mikrotik_xmit_limit')->default(1073741824);

but it did not work because obviously the field already exists so he understood that I wanted to create a new one so he gave duplicate field alert. I would like to know how I can fix this

    
asked by anonymous 22.02.2016 / 19:39

1 answer

1

Basically something like an alter table from sql should be done. In the documentation for laravel you have a guide to this: modifying columns . Basically you create a migration and add the change () in the example you put:

$table->string('mikrotik_rate_limit')->default('1048576/1048576')->change();
$table->bigInteger('mikrotik_recv_limit')->default(1073741824)->change();
$table->bigInteger('mikrotik_xmit_limit')->default(1073741824)->change();

For this you should add doctrine / dbal to your composer.json and run the install.

    
26.02.2016 / 00:29