import c from"node:path";import{cpSync as m,existsSync as e,mkdirSync as l}from"node:fs";import{logger as t}from"../../tools/notifiers/logger.js";import{fromCurrentDir as u}from"../../utils/index.js";const y=r=>{const s=["catalog-sqlite","main-sqlite","plugin-storage-sqlite"];for(const i of s){const o=u(import.meta.url,`./databases/${i}/migrations`),a=c.join(r.serverOutDir,"migrations",i);if(!e(o)){t.warn(`Migrations folder not found at ${o}`);continue}e(r.serverOutDir)||l(r.serverOutDir,{recursive:!0});try{m(o,a,{recursive:!0}),t.info("Successfully copied migrations")}catch(n){t.error("Failed to copy migrations folder: %s",n)}}};export{y as copyMigrationsFolder};
