1

This is my code:

public function up()
{
    Schema::table('organization_user', function (Blueprint $table) {
        $table->renameColumn('company_id', 'organization_id');
    });
}

I want to rename column in table. And in this table have an column is enum type. But errors: Unknown database type company_roles requested, Doctrine\DBAL\Platforms\PostgreSQL100Platform may
not support it. I use laravel 5.6

2

1 Answer 1

1

This issue may be related to what is mentioned in Laravel Docs "You can't rename columns in the table that has 'enum' type". See: enter image description here

I am afraid this is like 5 years old issue with Doctrine/DBal that Laravel uses see:[Bug] Schema builder - renameColumn fails on table with enum columns But one of the workarounds is also on the same issue report DB Query. For reference sake I'll put it here:

DB::statement("ALTER TABLE table_name MODIFY COLUMN column_name ENUM('Here','is','choices')");

In this case, you need to provide the right statement in the down() function of your migration class file to restore the state of the table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.