1

In Laravel 5.7 I created tiny field with rule

$table->tinyInteger('renewal_raise_invoice_before')->unsigned()->nullable()->after('renewal_raise_invoice_pre_pay');

But it appears that I need a bigger range. Which is the correct way to change its type to smallInteger?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Petro Gromovo
  • 1,755
  • 5
  • 33
  • 91

2 Answers2

1

Make new migration with:

Schema::table('sometable',function (Blueprint $table){
        $table->smallInteger('renewal_raise_invoice_before')->unsigned()->nullable()->change();
    });
Emil Georgiev
  • 529
  • 4
  • 15
1

In case you ran into some mysql issues as I ran before with 5.7 & 5.8 and MySql 8 you can do RAW queries in the migration

Schema::table('table_name',function (Blueprint $table){

  DB::statement('ALTER TABLE table_name MODIFY COLUMN renewal_raise_invoice_before smallint UNSIGNED NULL');

}
Eliecer
  • 81
  • 2