lillecarl | diff --git a/lix/libstore/local-store.cc b/lix/libstore/local-store.cc
index d7cfe6874..865d4e030 100644
--- a/lix/libstore/local-store.cc
+++ b/lix/libstore/local-store.cc
@@ -73,6 +73,7 @@ struct LocalStore::DBState::Stmts {
SQLiteStmt QueryDerivationOutputs;
SQLiteStmt QueryPathFromHashPart;
SQLiteStmt QueryValidPaths;
+ SQLiteStmt UpdateRegTime;
};
int getSchema(Path schemaPath)
@@ -296,7 +297,7 @@ void LocalStore::prepareStatements(DBState & state)
state.stmts->RegisterValidPath = state.db.create(
"insert into ValidPaths (path, hash, registrationTime, deriver, narSize, ultimate, sigs, ca) values (?, ?, ?, ?, ?, ?, ?, ?);");
state.stmts->UpdatePathInfo = state.db.create(
- "update ValidPaths set narSize = ?, hash = ?, ultimate = ?, sigs = ?, ca = ? where path = ?;");
+ "update ValidPaths set narSize = ?, hash = ?, ultimate = ?, sigs = ?, ca = ?, registrationTime = unixepoch() where path = ?;");
state.stmts->AddReference = state.db.create(
"insert or replace into Refs (referrer, reference) values (?, ?);");
state.stmts->QueryPathInfo = state.db.create(
@@ -318,6 +319,7 @@ void LocalStore::prepareStatements(DBState & state)
state.stmts->QueryPathFromHashPart = state.db.create(
"select path from ValidPaths where path >= ? limit 1;");
state.stmts->QueryValidPaths = state.db.create("select path from ValidPaths");
+ state.stmts->UpdateRegTime= state.db.create("update ValidPaths set registrationTime = unixepoch() where path = ?;");
}
@@ -715,6 +717,7 @@ try {
std::shared_ptr<const ValidPathInfo> LocalStore::queryPathInfoInternal(DBState & state, const StorePath & path)
{
+ state.stmts->UpdateRegTime.use()(printStorePath(path)).exec();
/* Get the path info. */
auto useQueryPathInfo(state.stmts->QueryPathInfo.use()(printStorePath(path)));
@@ -779,6 +782,7 @@ void LocalStore::updatePathInfo(DBState & state, const ValidPathInfo & info)
uint64_t LocalStore::queryValidPathId(DBState & state, const StorePath & path)
{
+ state.stmts->UpdateRegTime.use()(printStorePath(path)).exec();
auto use(state.stmts->QueryPathInfo.use()(printStorePath(path)));
if (!use.next()) // TODO: I guess if SQLITE got corrupted..?
throw InvalidPath("path '%s' does not exist in the Lix database", printStorePath(path));
@@ -788,6 +792,7 @@ uint64_t LocalStore::queryValidPathId(DBState & state, const StorePath & path)
bool LocalStore::isValidPath_(DBState & state, const StorePath & path)
{
+ state.stmts->UpdateRegTime.use()(printStorePath(path)).exec();
return state.stmts->QueryPathInfo.use()(printStorePath(path)).next();
}
How on earth does this not update registrationTime on a package when I build it? 🤔
| 01:56:19 |