abkrim's avatar
Level 13

Alter AUTOINCREMENT on SQlite3 database code work on tinker and not on App

For upgrade version of database, I need alter autoincrement for a table.

I test my code on tinker and work perfectly, but on app, fail.

$firstId = $this->setFirstMyTableId(); // get for example 56789

DB::update("UPDATE SQLITE_SEQUENCE SET seq = $firstId WHERE name = 'MyTable'");  // this code work perfectly on tinker and return 1

Beacuse fail, I need workaround create a first insert with 'id' = $firstId, but I like know why fail.

0 likes
0 replies

Please or to participate in this conversation.