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
INT8and you're asking the engine to convert toVARCHAR(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?