@@ -178,7 +178,6 @@ export const copyTableData = async (
178
178
// Process the fetched batch in smaller chunks for insertion
179
179
for ( let i = 0 ; i < batchRows . length ; i += insertBatchSize ) {
180
180
const insertBatch = batchRows . slice ( i , i + insertBatchSize ) ;
181
-
182
181
// Create a parameterized query for this insertion batch
183
182
const valueStrings = [ ] ;
184
183
const valueParams = [ ] ;
@@ -188,7 +187,14 @@ export const copyTableData = async (
188
187
const rowParams = [ ] ;
189
188
for ( const col of columns ) {
190
189
rowParams . push ( `$${ paramIndex ++ } ` ) ;
191
- valueParams . push ( row [ col ] ) ;
190
+ //workaround for metadata column
191
+ if ( col === "metadata" ) {
192
+ valueParams . push (
193
+ Array . isArray ( row [ col ] ) ? stringify ( row [ col ] ) : row [ col ] ,
194
+ ) ;
195
+ } else {
196
+ valueParams . push ( row [ col ] ) ;
197
+ }
192
198
}
193
199
valueStrings . push ( `(${ rowParams . join ( ", " ) } )` ) ;
194
200
}
@@ -198,6 +204,7 @@ export const copyTableData = async (
198
204
VALUES ${ valueStrings . join ( ", " ) }
199
205
` ;
200
206
207
+ console . log ( columns ) ;
201
208
await targetPool . query ( insertQuery , valueParams ) ;
202
209
203
210
processedRows += insertBatch . length ;
@@ -267,7 +274,7 @@ export const main = async (): Promise<void> => {
267
274
const targetDb = sourceColor === "blue" ? GREEN_DB : BLUE_DB ;
268
275
269
276
logger . info ( `Copying cache data from ${ sourceColor } to ${ targetColor } ...` ) ;
270
- await copyCacheData ( sourceDb , targetDb , connectionDetails ) ;
277
+ await copyCacheData ( "datalayer-postgres-db" , "GitcoinDatalayerGreen" , connectionDetails ) ;
271
278
272
279
logger . info ( `✅ Cache data copied from ${ sourceColor } to ${ targetColor } successfully` ) ;
273
280
0 commit comments