@@ -99,7 +99,7 @@ describe("Database", () => {
9999 expect ( tables . map ( ( table ) => table . name ) ) . not . toContain ( "_migrations" ) ;
100100 } ) ;
101101
102- it ( "should upgrade a known v1 supervisor schema to v3 when user_version is unset" , ( ) => {
102+ it ( "should upgrade a known v1 supervisor schema to v2 when user_version is unset" , ( ) => {
103103 const dbPath = join ( tempDir , "v1.db" ) ;
104104 const rawDb = new DatabaseSync ( dbPath ) ;
105105 rawDb . exec ( "PRAGMA user_version = 0" ) ;
@@ -116,7 +116,6 @@ describe("Database", () => {
116116 } > ;
117117 expect ( supervisorColumns . map ( ( column ) => column . name ) ) . toEqual (
118118 expect . arrayContaining ( [
119- "target_id" ,
120119 "evaluator_model" ,
121120 "max_supervision_count" ,
122121 "completed_supervision_count" ,
@@ -140,7 +139,7 @@ describe("Database", () => {
140139 expect ( upgradedIndex ?. name ) . toBe ( "idx_supervisor_cycle_attempts_cycle" ) ;
141140 } ) ;
142141
143- it ( "should upgrade a known v2 supervisor schema to v3 and backfill target ids" , ( ) => {
142+ it ( "should keep a known v2 supervisor schema current without adding target ids" , ( ) => {
144143 const dbPath = join ( tempDir , "v2.db" ) ;
145144 const rawDb = new DatabaseSync ( dbPath ) ;
146145 rawDb . exec ( "PRAGMA user_version = 2" ) ;
@@ -205,12 +204,15 @@ describe("Database", () => {
205204 const supervisorColumns = db . prepare ( "PRAGMA table_info(supervisors)" ) . all ( ) as Array < {
206205 name : string ;
207206 } > ;
208- expect ( supervisorColumns . map ( ( column ) => column . name ) ) . toContain ( "target_id" ) ;
207+ expect ( supervisorColumns . map ( ( column ) => column . name ) ) . not . toContain ( "target_id" ) ;
209208
210209 const upgradedRow = db
211- . prepare ( "SELECT target_id FROM supervisors WHERE id = ?" )
212- . get ( "sup-legacy" ) as { target_id : string } ;
213- expect ( upgradedRow . target_id ) . toBe ( "legacy_sup-legacy" ) ;
210+ . prepare ( "SELECT id, objective FROM supervisors WHERE id = ?" )
211+ . get ( "sup-legacy" ) as { id : string ; objective : string } ;
212+ expect ( upgradedRow ) . toEqual ( {
213+ id : "sup-legacy" ,
214+ objective : "Legacy supervisor" ,
215+ } ) ;
214216 } ) ;
215217
216218 it ( "should restamp user_version for an already-current schema when it is unset" , ( ) => {
0 commit comments