I am trying to run the following query in a migration:
UPDATE `notifications` SET `object_type`=CONCAT('App\\Models\\', object_type) WHERE `object_type` NOT LIKE 'App\\\\Models\\\\%';
It works fine in the console.
But when I am using it in the migration, it throws an error.
DB::statement("UPDATE `notifications` SET `object_type`=CONCAT('App\\Models\\', object_type) WHERE `object_type` NOT LIKE 'App\\\\Models\\\\%';");
Error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\\Models\\%'' at line 1 (SQL: UPDATE `sss_notifications` SET `object_type`=CONCAT('App\Models\', object_type) WHERE `object_type` NOT LIKE 'App\\Models\\%';)
What changes do I need to make it work?