I have a MySQL database with a table called user_level_attempt. That table has a ENUM type column with ['PROGRESSED', 'STOPPED', 'COMPLETED'] values. I need to write a migration to add another value (let's say 'PASSED') to that column. After adding, it'll look like this, ['PROGRESSED', 'STOPPED', 'COMPLETED', 'PASSED]. How can I do that in Laravel? I tried the following solution but it doesn't seem like a good practice/solution.
/**
* Schema table name to migrate
* @var string
*/
public $set_schema_table = 'bt_user_level_attempt';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table($this->set_schema_table, function ($table) {
$table->dropColumn('status');
});
Schema::table($this->set_schema_table, function ($table) {
$table->enum('status', ['PROGRESS', 'STOPPED', 'COMPLETED', 'PASSED'])->default('PROGRESS')->after('effective_time_spend');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table($this->set_schema_table, function ($table) {
$table->dropColumn('status');
});
Schema::table($this->set_schema_table, function ($table) {
$table->enum('status', ['PROGRESS', 'STOPPED', 'COMPLETED'])->default('PROGRESS')->after('effective_time_spend');
});
}
Thank you.