@@ -17,7 +17,7 @@ import { Command, Flag } from "effect/cli";
1717
1818import * as ProjectionStore from "../src/orchestration-v2/ProjectionStore.ts" ;
1919import { rebuildMessageSearch } from "../src/orchestration-v2/messageSearchIndex.ts" ;
20- import { migrationManifest , runMigrations } from "../src/persistence/Migrations.ts" ;
20+ import { runMigrations } from "../src/persistence/Migrations.ts" ;
2121import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient" ;
2222
2323export class MigrateDevDbNotInWorktreeError extends Schema . TaggedError < MigrateDevDbNotInWorktreeError > ( ) (
@@ -89,23 +89,10 @@ export class MigrateDevDbDestinationBusyError extends Schema.TaggedError<Migrate
8989 }
9090}
9191
92- export class MigrateDevDbSlotCollisionError extends Schema . TaggedError < MigrateDevDbSlotCollisionError > ( ) (
93- "MigrateDevDbSlotCollisionError" ,
94- {
95- slot : Schema . Number ,
96- codeName : Schema . String ,
97- appliedName : Schema . String ,
98- } ,
99- ) {
100- override get message ( ) : string {
101- return `Migration slot collision at ${ this . slot } : this checkout registers '${ this . codeName } ' but the database already applied '${ this . appliedName } ' in that slot. Renumber the new migration to a free slot.` ;
102- }
103- }
104-
10592export class MigrateDevDbPhaseError extends Schema . TaggedError < MigrateDevDbPhaseError > ( ) (
10693 "MigrateDevDbPhaseError" ,
10794 {
108- phase : Schema . Literals ( [ "snapshot" , "prune" , "compact" , "migrate" , "verify" ] ) ,
95+ phase : Schema . Literals ( [ "snapshot" , "prune" , "compact" , "migrate" ] ) ,
10996 databasePath : Schema . String ,
11097 cause : Schema . Defect ( ) ,
11198 } ,
@@ -416,19 +403,6 @@ const pruneSnapshot = Effect.fn("pruneDevDbSnapshot")(function* (input: RunMigra
416403 } ;
417404} ) ;
418405
419- const verifyMigrationSlots = Effect . fn ( "verifyMigrationSlots" ) ( function * ( ) {
420- const sql = yield * SqlClient . SqlClient ;
421- const applied = yield * sql < { migration_id : number ; name : string } > `
422- SELECT migration_id, name FROM effect_sql_migrations` ;
423- const appliedById = new Map ( applied . map ( ( row ) => [ Number ( row . migration_id ) , row . name ] ) ) ;
424- for ( const [ slot , codeName ] of migrationManifest ) {
425- const appliedName = appliedById . get ( slot ) ;
426- if ( appliedName !== undefined && appliedName !== codeName ) {
427- return yield * new MigrateDevDbSlotCollisionError ( { slot, codeName, appliedName } ) ;
428- }
429- }
430- } ) ;
431-
432406export const runMigrateDevDb = Effect . fn ( "runMigrateDevDb" ) ( function * (
433407 input : RunMigrateDevDbInput ,
434408 options : RunMigrateDevDbOptions = { } ,
@@ -510,17 +484,6 @@ export const runMigrateDevDb = Effect.fn("runMigrateDevDb")(function* (
510484 wrapPhase ( "migrate" , snapshotPath ) ,
511485 ) ;
512486
513- // Detect migration slot collisions before replacing the worktree database.
514- yield * verifyMigrationSlots ( ) . pipe (
515- Effect . provide ( NodeSqliteClient . layer ( { filename : snapshotPath } ) ) ,
516- Effect . catchTags ( {
517- SqlError : ( cause ) =>
518- Effect . fail (
519- new MigrateDevDbPhaseError ( { phase : "verify" , databasePath : snapshotPath , cause } ) ,
520- ) ,
521- } ) ,
522- ) ;
523-
524487 yield * Console . log (
525488 `Pruning to ${ input . projects } projects, ${ input . threadsPerProject } stopped threads each...` ,
526489 ) ;
0 commit comments