@@ -77,12 +77,6 @@ const SCHEMA = `
7777 value TEXT NOT NULL
7878 );
7979
80- CREATE TABLE IF NOT EXISTS memory_access_log (
81- id INTEGER PRIMARY KEY AUTOINCREMENT,
82- content_hash TEXT NOT NULL,
83- accessed_at REAL NOT NULL
84- );
85- CREATE INDEX IF NOT EXISTS idx_access_log_at ON memory_access_log(accessed_at);
8680` ;
8781
8882const SEED_DATA : TestMemory [ ] = [
@@ -248,15 +242,6 @@ const SEED_METADATA = [
248242 { key : 'fts5_enabled' , value : 'true' } ,
249243] ;
250244
251- // Acces seed : quelques entrees sur 2 jours differents
252- const SEED_ACCESS_LOG = [
253- { content_hash : 'hash_aaa111' , accessed_at : 1771000100 } , // 2026-02-13
254- { content_hash : 'hash_aaa111' , accessed_at : 1771000200 } , // 2026-02-13
255- { content_hash : 'hash_bbb222' , accessed_at : 1771088500 } , // 2026-02-14
256- { content_hash : 'hash_eee555' , accessed_at : 1771088600 } , // 2026-02-14
257- { content_hash : 'hash_eee555' , accessed_at : 1771088700 } , // 2026-02-14
258- ] ;
259-
260245export function createTestDb ( ) : DatabaseType {
261246 const db = new Database ( ':memory:' ) ;
262247 sqliteVec . load ( db ) ;
@@ -291,15 +276,10 @@ export function createTestDb(): DatabaseType {
291276 INSERT INTO metadata (key, value) VALUES (@key, @value)
292277 ` ) ;
293278
294- const insertAccessLog = db . prepare ( `
295- INSERT INTO memory_access_log (content_hash, accessed_at) VALUES (@content_hash, @accessed_at)
296- ` ) ;
297-
298279 const seedAll = db . transaction ( ( ) => {
299280 for ( const m of SEED_DATA ) insertMemory . run ( m ) ;
300281 for ( const g of SEED_GRAPH ) insertGraph . run ( g ) ;
301282 for ( const m of SEED_METADATA ) insertMeta . run ( m ) ;
302- for ( const a of SEED_ACCESS_LOG ) insertAccessLog . run ( a ) ;
303283
304284 // Inserer des embeddings factices pour les memoires (id 1-5)
305285 for ( let i = 1 ; i <= SEED_DATA . length ; i ++ ) {
@@ -315,6 +295,35 @@ export function createTestDb(): DatabaseType {
315295 return db ;
316296}
317297
298+ // Acces seed : quelques entrees sur 2 jours differents
299+ const SEED_ACCESS_LOG = [
300+ { content_hash : 'hash_aaa111' , accessed_at : 1771000100 } , // 2026-02-13
301+ { content_hash : 'hash_aaa111' , accessed_at : 1771000200 } , // 2026-02-13
302+ { content_hash : 'hash_bbb222' , accessed_at : 1771088500 } , // 2026-02-14
303+ { content_hash : 'hash_eee555' , accessed_at : 1771088600 } , // 2026-02-14
304+ { content_hash : 'hash_eee555' , accessed_at : 1771088700 } , // 2026-02-14
305+ ] ;
306+
307+ export function createTestAccessLogDb ( ) : DatabaseType {
308+ const db = new Database ( ':memory:' ) ;
309+ db . exec ( `
310+ CREATE TABLE memory_access_log (
311+ id INTEGER PRIMARY KEY AUTOINCREMENT,
312+ content_hash TEXT NOT NULL,
313+ accessed_at REAL NOT NULL
314+ );
315+ CREATE INDEX idx_access_log_at ON memory_access_log(accessed_at);
316+ ` ) ;
317+
318+ const insert = db . prepare (
319+ 'INSERT INTO memory_access_log (content_hash, accessed_at) VALUES (@content_hash, @accessed_at)'
320+ ) ;
321+
322+ for ( const a of SEED_ACCESS_LOG ) insert . run ( a ) ;
323+
324+ return db ;
325+ }
326+
318327// Nombre de memoires non-supprimees dans le seed
319328export const ACTIVE_MEMORY_COUNT = SEED_DATA . filter ( m => m . deleted_at === null ) . length ;
320329export const TOTAL_MEMORY_COUNT = SEED_DATA . length ;
0 commit comments