dimanche 28 juillet 2019

Laravel 5: Add new value in my column migration

I have existing table and columns. One of my column named status the datatype is enum('0','1') with the default value of 0. And right now I want to add more values in my status column. Will look like this enum('0','1','2','3') with also default value of 0.

My Migration

public function up()
    {
        //
         DB::statement("ALTER TABLE purchase_requisitions CHANGE status ENUM('0', '1', '2','3','4','5')")->default('0')->comment('0 = Unproccessed 1 = Processed');
    }

When I migrate this there's an error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i
  n your SQL syntax; check the manual that corresponds to your MySQL server v
  ersion for the right syntax to use near '('0', '1', '2','3','4','5')' at li
  ne 1

Question: How can I implement this using the migration?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire