Skip to content

Commit

Permalink
fix phone number migration
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-duport committed May 30, 2024
1 parent 6a93c0f commit 94e6fcc
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ async function updateTable(
{ ids: [], phones: [] },
);

const updateQuery = `UPDATE actors
SET phone = unnested.phone
FROM (SELECT unnest($1::int[]) as id, unnest($2::text[]) as phone) as unnested
WHERE actors.id = unnested.id;`;
const updateQuery = `UPDATE ${tableName}
SET ${columnName} = unnested.phone
FROM (SELECT unnest($1::${tableName === "actors" ? "int[]" : "uuid[]"}) as id, unnest($2::text[]) as phone) as unnested
WHERE ${tableName}.${primaryKey} = unnested.id;`;

console.timeEnd("typescript process");
console.time("update query");
Expand Down

0 comments on commit 94e6fcc

Please sign in to comment.