How can I create a migration to add a value to an enum in eloquent?

Web Development

I have a table that contains an enum field

CREATE TABLE `user_status` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`values` enum('on', 'off'),
PRIMARY KEY (`id`),
) ENGINE=InnoDB;

How can I create a migration to add a value to the enum field?
 


If you want to unleash your potential in this competitive field, please visit the Web Development course page for more information, where you can find the Web Development tutorials and Web Development frequently asked interview questions and answers as well.

1
Answers

Replies

Ans: The below code can be used to create a migration to add a value to an enum in eloquent.


public function up()


    {


        Schema::create('dt_warehouses', function (Blueprint $table) 


{


            **$table->enum('isactive', ['Y', 'N'])->default('Y');**


            $table->timestamps();


        });


    }

 
 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
WhatsApp
To Top