Fix contributor website import script (#8404)

We had duplicate entries in the database for issueLabels/ prLabels
This commit is contained in:
Félix Malfait
2024-11-08 10:57:17 +01:00
committed by GitHub
parent f06cdbdfc6
commit b2004fe6b4
6 changed files with 33 additions and 12 deletions

View File

@ -35,6 +35,7 @@ const insertMany = async (
options?: {
onConflictKey?: string;
onConflictUpdateObject?: any;
onConflictDoNothing?: boolean;
},
) => {
const query = pgDb.insert(model).values(data);
@ -50,6 +51,10 @@ const insertMany = async (
}
}
if (options?.onConflictDoNothing && !options?.onConflictKey) {
return query.onConflictDoNothing().execute();
}
if (options?.onConflictKey) {
return query
.onConflictDoNothing({