Skip to content

Commit 2d999f7

Browse files
only21milclaude
andcommitted
fix(server): renumber the message search text migration to 082
Another open change also adds migration 081, so this one moves to the next free id. The migration, its test and the comments that name it follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8e7ea08 commit 2d999f7

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎apps/server/src/orchestration-v2/messageSearchIndex.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ export const messageSearchText = (sql: SqlClient.SqlClient) =>
6464

6565
/**
6666
* A message's stored text with apostrophes folded, what the index held before
67-
* migration 81. Migration 69's backfill uses it. `payload` is the message's
67+
* migration 82. Migration 69's backfill uses it. `payload` is the message's
6868
* JSON column.
6969
*/
7070
export const indexedMessageText = (sql: SqlClient.SqlClient, payload: string) =>
7171
sql.literal(foldApostrophes(`json_extract(${payload}, '$.text')`));
7272

7373
// What the index stores: a message's readable text with apostrophes folded.
74-
// Migrations 69 and 74 create the triggers before migration 81 adds
74+
// Migrations 69 and 74 create the triggers before migration 82 adds
7575
// search_text, and `t3 doctor` can rebuild a database that has not migrated,
7676
// so those fall back to the stored text.
7777
const indexedText = Effect.fn("MessageSearchIndex.indexedText")(function* (
@@ -101,7 +101,7 @@ export const createMessageSearchTriggers = Effect.fn("MessageSearchIndex.createT
101101
`;
102102
// Streaming deltas rewrite the row many times a second; skip them until the
103103
// message settles. Upserts rewrite every column, so re-index only when what
104-
// the index stores changed; migration 81's backfill writes only search_text.
104+
// the index stores changed; migration 82's backfill writes only search_text.
105105
// Deleting a rowid the index never held is a no-op.
106106
yield* sql`
107107
CREATE TRIGGER orchestration_v2_message_search_update

‎apps/server/src/persistence/Migrations.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ import Migration0077 from "./Migrations/077_RepairBooleanSettledOverride.ts";
8383
import Migration0078 from "./Migrations/078_DropOrchestrationEventCorrelationIndex.ts";
8484
import Migration0079 from "./Migrations/079_DelegatedRecoveryIndexes.ts";
8585
import Migration0080 from "./Migrations/080_ScheduledTaskThreadMode.ts";
86-
import Migration0081 from "./Migrations/081_ProjectionMessageSearchText.ts";
86+
import Migration0082 from "./Migrations/082_ProjectionMessageSearchText.ts";
8787

8888
const migrationEntries = [
8989
[1, "OrchestrationEvents", Migration0001],
@@ -167,7 +167,7 @@ const migrationEntries = [
167167
[78, "DropOrchestrationEventCorrelationIndex", Migration0078],
168168
[79, "DelegatedRecoveryIndexes", Migration0079],
169169
[80, "ScheduledTaskThreadMode", Migration0080],
170-
[81, "ProjectionMessageSearchText", Migration0081],
170+
[82, "ProjectionMessageSearchText", Migration0082],
171171
] as const;
172172

173173
export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const);

apps/server/src/persistence/Migrations/081_ProjectionMessageSearchText.test.ts renamed to apps/server/src/persistence/Migrations/082_ProjectionMessageSearchText.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ const indexed = (sql: SqlClient.SqlClient, phrase: string) =>
3333
`.pipe(Effect.map((rows) => rows.map((row) => row.message_id)));
3434

3535
it.layer(NodeSqliteClient.layer({ filename: ":memory:" }))(
36-
"081_ProjectionMessageSearchText",
36+
"082_ProjectionMessageSearchText",
3737
(it) => {
3838
it.effect("backfills readable text only for messages whose citations read differently", () =>
3939
Effect.gen(function* () {
4040
const sql = yield* SqlClient.SqlClient;
41-
yield* runMigrations({ toMigrationInclusive: 80 });
41+
yield* runMigrations({ toMigrationInclusive: 81 });
4242
const insertMessage = (messageId: string, text: unknown) => sql`
4343
INSERT INTO orchestration_v2_projection_messages (
4444
message_id, thread_id, role, streaming, created_at, updated_at, payload_json
@@ -71,8 +71,8 @@ it.layer(NodeSqliteClient.layer({ filename: ":memory:" }))(
7171
{ discard: true },
7272
);
7373

74-
assert.deepEqual(yield* runMigrations({ toMigrationInclusive: 81 }), [
75-
[81, "ProjectionMessageSearchText"],
74+
assert.deepEqual(yield* runMigrations({ toMigrationInclusive: 82 }), [
75+
[82, "ProjectionMessageSearchText"],
7676
]);
7777
const rows = yield* sql<{
7878
readonly message_id: string;

apps/server/src/persistence/Migrations/081_ProjectionMessageSearchText.ts renamed to apps/server/src/persistence/Migrations/082_ProjectionMessageSearchText.ts

File renamed without changes.

‎apps/server/src/persistence/reconcileV2PreviewMigration.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe("V2 preview upgrade", () => {
6060
[78, "DropOrchestrationEventCorrelationIndex"],
6161
[79, "DelegatedRecoveryIndexes"],
6262
[80, "ScheduledTaskThreadMode"],
63-
[81, "ProjectionMessageSearchText"],
63+
[82, "ProjectionMessageSearchText"],
6464
]);
6565
assert.deepStrictEqual(yield* runMigrations(), []);
6666
assert.deepStrictEqual(yield* sql`SELECT * FROM orchestration_v2_legacy_imports`, imports);
@@ -164,7 +164,7 @@ describe("V2 preview upgrade", () => {
164164
[78, "DropOrchestrationEventCorrelationIndex"],
165165
[79, "DelegatedRecoveryIndexes"],
166166
[80, "ScheduledTaskThreadMode"],
167-
[81, "ProjectionMessageSearchText"],
167+
[82, "ProjectionMessageSearchText"],
168168
]);
169169
}).pipe(Effect.provide(NodeSqliteClient.layer({ filename: ":memory:" }))),
170170
);

0 commit comments

Comments
 (0)