Skip to content

Commit 98f657a

Browse files
committed
fix(stack): adapt supabase merge test to the removed v3 freeTextSearch tuner
Rebasing onto feat/eql-v3-text-search-schema picks up 8123839, which removed the vestigial chainable .freeTextSearch(opts) tuner from EncryptedTextSearchColumn — in v3 the concrete type defines capabilities, so match is always emitted with the default config. The mergeDeclaredTables test used tuned match options as the observable proof that a declared column wins over its synthesized twin. That observable is gone: declared and synthesized TextSearch columns now build byte-identically. Assert builder instance identity instead, which proves the same behaviour and is the only remaining signal. Drop the now-stale "tuner options" clause from the mergeDeclaredTables doc comment.
1 parent dcb3745 commit 98f657a

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

packages/stack/__tests__/supabase-schema-builder.test.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,21 @@ describe('synthesizeTables', () => {
7373
})
7474

7575
describe('mergeDeclaredTables', () => {
76-
it('lets a declared TextSearch column keep its tuned match options', () => {
76+
it('keeps the declared builder instance over the synthesized one', () => {
7777
const synth = synthesizeTables(introspection)
7878
const declaredTable = encryptedTable('users', {
79-
email: types
80-
.TextSearch('email')
81-
.freeTextSearch({ include_original: false }),
79+
email: types.TextSearch('email'),
8280
})
8381
const merged = mergeDeclaredTables(synth, { users: declaredTable })
84-
const built = merged.tables.get('users')!.build()
85-
expect(built.columns.email.indexes.match?.include_original).toBe(false)
86-
expect(built.columns.amount).toBeDefined()
82+
const mergedTable = merged.tables.get('users')!
83+
84+
// A declared column and its synthesized twin build byte-identically (see
85+
// above), so instance identity is the only observable proof that the
86+
// declared builder is the one that survived the merge.
87+
expect(mergedTable.columnBuilders.email).toBe(
88+
declaredTable.columnBuilders.email,
89+
)
90+
expect(mergedTable.build().columns.amount).toBeDefined()
8791
expect(merged.allColumns.get('users')).toEqual(
8892
synth.allColumns.get('users'),
8993
)

packages/stack/src/supabase/schema-builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ export function synthesizeTables(
5656
* Replace synthesized tables with a merge of declared-over-synthesized columns.
5757
* For each declared column, drop the synthesized entry that resolves to the
5858
* same DB name and add the declared builder under its JS property name (so a
59-
* property→DB rename and any tuner options survive). Undeclared columns stay
60-
* synthesized. `allColumns` is unchanged (DB-name based, from introspection).
59+
* property→DB rename survives). Undeclared columns stay synthesized.
60+
* `allColumns` is unchanged (DB-name based, from introspection).
6161
*/
6262
export function mergeDeclaredTables(
6363
synth: SynthesizedSchema,

0 commit comments

Comments
 (0)