sqlite insert results in error: "SQLite error: no such table: main.__old_push_items"
2 of my 3 table insert work fine, but my
Versions
Insert code uses Zod to validate, which it passes succesfully
I also tried raw sql insert but it gives the same error
auctionsauctions table inserts do not work for some reason. When I try to insert data into my sqlite db on Turso I get the following error:LibsqlError: SQLITE_UNKNOWN: SQLite error: no such table: main.__old_push_itemsLibsqlError: SQLITE_UNKNOWN: SQLite error: no such table: main.__old_push_itemsVersions
{
"drizzle-kit": "^0.20.4",
"drizzle-orm": "^0.29.0"
}{
"drizzle-kit": "^0.20.4",
"drizzle-orm": "^0.29.0"
}Insert code uses Zod to validate, which it passes succesfully
const newscanmeta = await db
.insert(scanmeta)
.values({
realm: entry.realm,
faction: entry.faction as 'Alliance' | 'Horde' | 'Neutral',
scanner: entry.char,
timestamp: new Date(entry.ts * 1000).toISOString(),
})
.onConflictDoUpdate({
target: [scanmeta.timestamp, scanmeta.scanner],
set: {
scanner: entry.char,
timestamp: new Date(entry.ts * 1000).toISOString(),
},
})
.returning({ id: scanmeta.id });
const scanID = newscanmeta[0]?.id;
const newAuction = insertAuctionsSchema.safeParse({
scanId: scanID,
itemId: item,
timestamp: new Date(scan.ts * 1000).toISOString(),
seller,
timeLeft: a.TimeLeft,
itemCount: a.ItemCount,
minBid: a.MinBid,
buyout: a.Buyout,
curBid: a.CurBid,
});
if (!newAuction.success) {
console.error(fromZodError(newAuction.error));
continue;
}
await db.insert(auctions).values(newAuction.data);const newscanmeta = await db
.insert(scanmeta)
.values({
realm: entry.realm,
faction: entry.faction as 'Alliance' | 'Horde' | 'Neutral',
scanner: entry.char,
timestamp: new Date(entry.ts * 1000).toISOString(),
})
.onConflictDoUpdate({
target: [scanmeta.timestamp, scanmeta.scanner],
set: {
scanner: entry.char,
timestamp: new Date(entry.ts * 1000).toISOString(),
},
})
.returning({ id: scanmeta.id });
const scanID = newscanmeta[0]?.id;
const newAuction = insertAuctionsSchema.safeParse({
scanId: scanID,
itemId: item,
timestamp: new Date(scan.ts * 1000).toISOString(),
seller,
timeLeft: a.TimeLeft,
itemCount: a.ItemCount,
minBid: a.MinBid,
buyout: a.Buyout,
curBid: a.CurBid,
});
if (!newAuction.success) {
console.error(fromZodError(newAuction.error));
continue;
}
await db.insert(auctions).values(newAuction.data);I also tried raw sql insert but it gives the same error
await db.run(sql`
INSERT INTO ${auctions} (scanId, itemId, ts, seller, timeLeft, itemCount, minBid, buyout, curBid)
VALUES (${newAuction.data.scanId}, ${newAuction.data.itemId}, ${newAuction.data.timestamp}, ${newAuction.data.seller}, ${newAuction.data.timeLeft}, ${newAuction.data.itemCount}, ${newAuction.data.minBid}, ${newAuction.data.buyout}, ${newAuction.data.curBid})
`);await db.run(sql`
INSERT INTO ${auctions} (scanId, itemId, ts, seller, timeLeft, itemCount, minBid, buyout, curBid)
VALUES (${newAuction.data.scanId}, ${newAuction.data.itemId}, ${newAuction.data.timestamp}, ${newAuction.data.seller}, ${newAuction.data.timeLeft}, ${newAuction.data.itemCount}, ${newAuction.data.minBid}, ${newAuction.data.buyout}, ${newAuction.data.curBid})
`);