Answer the question
In order to leave comments, you need to log in
Sqlite is not added to the user, how to fix it?
If more pieces of code are needed, then I will throw off the
error itself:
/root/fake-transfer/index.js:570
createUserStatement.run(Object.values(user).map(mapObjectValue));
SqliteError: NOT NULL constraint failed: users.id
at getOrCreateUser (/root/fake-transfer/index.js:570:24)
at getUser (/root/fake-transfer/index.js:564:22)
at getTimeNow (/root/fake-transfer/index.js:609:60)
at modifyHistoryInput (/root/fake-transfer/index.js:827:13)
at modifyIPhoneHistoryInput (/root/fake-transfer/index.js:778:14)
at HistoryType.withItems.size [as modifyInput] (/root/fake-transfer/index.js:378:110)
at sendFake (/root/fake-transfer/index.js:895:27)
function getUser(id) {
return users[id] || getOrCreateUser(id);
function getOrCreateUser(id) {
const count = getUserCountStatement.get(id);
if (count["count()"] == 0) {
const user = new User(id);
createUserStatement.run(Object.values(user).map(mapObjectValue)); // 570 error line
return user;
}
users[id] = loadUserStatement.get(id);
users[id].bills = JSON.parse(users[id].bills);
return users[id];
}
}
function saveUser(user) {
const values = userKeysNoIds.map(x => mapObjectValue(user[x]));
values.push(user.id);
updateUserStatement.run(values);
}
Answer the question
In order to leave comments, you need to log in
Bro, let me highlight the mistake for you, and you can guess for yourself:
SqliteError: NOT NULL constraint failed: users.id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question