1

I am new to PHP and laravel platform,need your help to resolve PDOException on run the migration task to alter table column type from number to string.

...
public function up()
{
    Schema::table('BuildTable', function (Blueprint $table) {
       $table->string('snapshot_id')->change();
    });

}
....

getting PDOException on run the migration task

Doctrine\DBAL\Driver\PDOException::("SQLSTATE[0A000]: Feature not supported: 7 ERROR:  unimplemented: type conversion from INT8 to VARCHAR(255) requires overwriting existing values which is not yet implemented
HINT:  You have attempted to use a feature that is not yet implemented.

Existing table structure was created using

      Schema::create(
        $this->tablename,
        function (Blueprint $table) {
            $table->increments('id');
            $table->integer('account_id')->unsigned();
            $table->integer('snapshot_id')->unsigned();
            $table->timestamps(6);
            $table->softDeletes('deleted_at', 6)->default(null);
        }
    );

The existing table already have data in snapshot_id

Php version is 7.3.20 running on linux mint OS , Database - cockroachDB

6
  • Please read: stackoverflow.com/questions/32940495/… Commented Aug 5, 2020 at 7:13
  • 1
    Does this answer your question? How to change column data type in laravel 5.6? Commented Aug 5, 2020 at 7:35
  • Chris , the details didn't resolve the issue , I am getting "SQLSTATE[0A000]: Feature not supported: 7 ERROR: unimplemented: type conversion from INT8 to VARCHAR(255) requires overwriting existing values which is not yet implemented Commented Aug 5, 2020 at 7:38
  • I think the error message is fairly self explanatory. Your table already contains data which has been stored as INT8 and you're asking the engine to convert to VARCHAR(255) which it doesn't know how to do. If the table were empty of data it would be different. Why do you want to convert what looks to be a foreign key to a string anyway? Commented Aug 5, 2020 at 8:03
  • 1
    @sykez @ Unflux You are correct,Its a database related issue as I am getting similar exception on direct SQL execution in tool too. We are using cockroachDB and it looks like direct data conversion from INT8 to VARCHAR feature not available for this particular version of it Commented Aug 5, 2020 at 12:22

1 Answer 1

2

This feature will be experimentally available in CockroachDB v20.2, which is getting released later this year.

If you want, you can test out with an alpha version (v20.2.0-alpha.2) which has this functionality. See the release notes. To use it, you need to set the following session variable: SET enable_experimental_alter_column_type_general = true;

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.