I am working with migrations in Laravel and I have a partners table that has a type attribute of type enum with the following values:
$table->enum('type', ['cliente', 'proveedor', 'empleado', 'transportadora'])->nullable();
What I need is the following: Create another migration so that you can modify the partners table, adding a value to the enum so that the database is as follows:
['cliente', 'proveedor', 'empleado', 'transportadora', 'nuevo_dato']
What I tried so far was the following:
Schema::table('partners', function ($table) {
DB::statement("ALTER COLUMN 'type' ADD VALUE 'nuevo_dato' AFTER 'cliente'");
});
And I also tried:
Schema::table('partners', function ($table) {
$table->enum('type', ['cliente', 'proveedor', 'empleado', 'transportadora', 'nuevo_dato'])->change();
});
And ...
DB::statement("ALTER TABLE 'partners' MODIFY COLUMN 'type' enum('nuevo_dato') NOT NULL AFTER 'transportadora'");
Without reaching the expected result. I would appreciate it if you would help me with this. (PS: I'm using PostgreSQL)