@@ -105,15 +105,19 @@ export const make = (strategies: AbiStore.AbiStore['strategies']) =>
105105 )` . pipe ( Effect . tapError ( ( error ) => Effect . logError ( `Failed to create v3 table during migration: ${ error } ` ) ) )
106106
107107 // Check if v2 table exists before attempting migration
108- const v2TableExists = yield * q . onDialectOrElse ( {
109- sqlite : ( ) => q `SELECT name FROM sqlite_master WHERE type='table' AND name='_loop_decoder_contract_abi_v2'` ,
110- pg : ( ) => q `SELECT tablename FROM pg_tables WHERE tablename='_loop_decoder_contract_abi_v2'` ,
111- mysql : ( ) => q `SELECT table_name FROM information_schema.tables WHERE table_name='_loop_decoder_contract_abi_v2'` ,
112- orElse : ( ) => q `SELECT COUNT(*) as count FROM ${ tableV2 } WHERE 1=0` , // Try to query table directly
113- } ) . pipe (
114- Effect . map ( ( rows ) => rows . length > 0 ) ,
115- Effect . catchAll ( ( ) => Effect . succeed ( false ) ) ,
116- )
108+ const v2TableExists = yield * q
109+ . onDialectOrElse ( {
110+ sqlite : ( ) =>
111+ q `SELECT name FROM sqlite_master WHERE type='table' AND name='_loop_decoder_contract_abi_v2'` ,
112+ pg : ( ) => q `SELECT tablename FROM pg_tables WHERE tablename='_loop_decoder_contract_abi_v2'` ,
113+ mysql : ( ) =>
114+ q `SELECT table_name FROM information_schema.tables WHERE table_name='_loop_decoder_contract_abi_v2'` ,
115+ orElse : ( ) => q `SELECT COUNT(*) as count FROM ${ tableV2 } WHERE 1=0` , // Try to query table directly
116+ } )
117+ . pipe (
118+ Effect . map ( ( rows ) => rows . length > 0 ) ,
119+ Effect . catchAll ( ( ) => Effect . succeed ( false ) ) ,
120+ )
117121
118122 if ( ! v2TableExists ) {
119123 yield * Effect . logInfo ( 'No v2 table found, skipping data migration' )
@@ -172,9 +176,7 @@ export const make = (strategies: AbiStore.AbiStore['strategies']) =>
172176 )
173177 ` . pipe (
174178 Effect . tap ( ( ) => Effect . logInfo ( 'Successfully migrated ABIs from v2 to v3 table with preserved IDs' ) ) ,
175- Effect . tapError ( ( error ) =>
176- Effect . logError ( `Failed to migrate ABIs from v2 to v3 table: ${ error } ` )
177- )
179+ Effect . tapError ( ( error ) => Effect . logError ( `Failed to migrate ABIs from v2 to v3 table: ${ error } ` ) ) ,
178180 )
179181 } ) ,
180182 ) ,
@@ -218,8 +220,10 @@ export const make = (strategies: AbiStore.AbiStore['strategies']) =>
218220 } ) . pipe (
219221 Effect . tapError ( ( error ) =>
220222 Effect . logError (
221- `Failed to insert ABI into database for ${ abi . type } key (address: ${ key . address } , chainID: ${ key . chainID
222- } ). ABI status: ${ abi . status } , ABI length: ${ abi . abi ?. length || 'null' } , source: ${ abi . source || 'unknown'
223+ `Failed to insert ABI into database for ${ abi . type } key (address: ${ key . address } , chainID: ${
224+ key . chainID
225+ } ). ABI status: ${ abi . status } , ABI length: ${ abi . abi ?. length || 'null' } , source: ${
226+ abi . source || 'unknown'
223227 } . Error: ${ error } `,
224228 ) ,
225229 ) ,
@@ -235,7 +239,8 @@ export const make = (strategies: AbiStore.AbiStore['strategies']) =>
235239 const items = yield * sql ` SELECT * FROM ${ table } WHERE ${ query } ` . pipe (
236240 Effect . tapError ( ( error ) =>
237241 Effect . logError (
238- `Failed to query ABI from database for key (address: ${ address } , signature: ${ signature || 'none'
242+ `Failed to query ABI from database for key (address: ${ address } , signature: ${
243+ signature || 'none'
239244 } , event: ${ event || 'none' } , chainID: ${ chainID } ): ${ error } `,
240245 ) ,
241246 ) ,
0 commit comments