From 56b18618bee3df04e2712d7350f07c4d3af336fd Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Thu, 9 Jul 2026 00:34:16 +0200 Subject: [PATCH] Showing number of newly added creators in ManyVids seed. --- seeds/09_manyvids.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/seeds/09_manyvids.js b/seeds/09_manyvids.js index 7a4aec15..b2cd5624 100644 --- a/seeds/09_manyvids.js +++ b/seeds/09_manyvids.js @@ -7,7 +7,7 @@ const limit = Number(process.env.MV_LIMIT) || 1000; const sorting = process.env.MV_SORT || 'followers'; // followers, top, mostActive, newest, trending async function fetchCreators(page = 1, acc = []) { - console.log(`Fetching creators ${acc.length}/${limit}`); + console.log(`Fetching ${acc.length}/${limit} creators by ${sorting}`); // size seems to be capped at 70 const res = await unprint.get(`https://api.manyvids.com/search/creators/list?contentPref=1,2,3&sort=${sorting}&size=50&from=${(page - 1) * 50}`); @@ -42,7 +42,7 @@ exports.seed = async function (knex) { throw new Error('ManyVids found, did the network migration run?'); } - await knex('entities') + const result = await knex('entities') .insert(channels.map((channel) => ({ name: channel.name, slug: channel.slug, @@ -51,7 +51,8 @@ exports.seed = async function (knex) { has_logo: false, }))) .onConflict(['slug', 'type']) - .merge(['name', 'url']); + .merge(['name', 'url']) + .returning(knex.raw('(xmax = 0) as inserted')); - console.log(`Done! ${channels.length} ManyVids creators added as channels`); + console.log(`Done! ${result.filter((row) => row.inserted).length}/${channels.length} ManyVids creators newly added as channels`); };