import { utilsApi } from '../src/manticore.js'; import { syncStashes } from '../src/sync.js'; import runTool from './run-tool.js'; export async function rebuildStashes() { await utilsApi.sql('drop table if exists scenes_stashed'); await utilsApi.sql(`create table if not exists scenes_stashed ( scene_id int, stash_id int, user_id int, created_at timestamp )`); await utilsApi.sql('drop table if exists movies_stashed'); await utilsApi.sql(`create table if not exists movies_stashed ( movie_id int, stash_id int, user_id int, created_at timestamp )`); await utilsApi.sql('drop table if exists actors_stashed'); await utilsApi.sql(`create table if not exists actors_stashed ( actor_id int, stash_id int, user_id int, created_at timestamp )`); console.log('Recreated stash tables, syncing stashes...'); await syncStashes('scene'); await syncStashes('actor'); await syncStashes('movie'); } if (import.meta.main) { runTool(rebuildStashes); }