@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.3 kB
JavaScript
import{startLoggerBuffering as e,stopLoggerBuffering as t}from"../../logger/index.mjs";import n from"../logger.mjs";import r from"./migrate.mjs";import i from"./migrate-reset.mjs";import{confirm as a}from"@inquirer/prompts";const o=async o=>{try{e();let s=n.startTimer(),c=o?.force??!1;if(n.warn(`This will drop all database tables and re-run all migrations`),!c){let e;try{e=await a({message:`Are you sure you want to fresh migrate the database? This will drop ALL tables and re-run migrations. This action cannot be undone.`,default:!1})}catch(e){throw e instanceof Error&&e.name===`ExitPromptError`&&(await t(),process.exit(0)),e}e||(n.info(`Fresh migration cancelled`),await t(),process.exit(0))}await i({mode:`return`})({force:!0})||(await t(),process.exit(1)),await r({mode:`return`})({skipSyncSteps:!1,skipEnvValidation:!0,allowDestructive:!0})||(await t(),process.exit(1));let l=s();n.log(n.createBadge(`LUCID CMS`),`Fresh migration completed`,n.color.green(`successfully`),`in`,n.color.green(n.formatMilliseconds(l)),{spaceAfter:!0,spaceBefore:!0}),await t(),process.exit(0)}catch(e){e instanceof Error?n.errorInstance(e,`Fresh migration failed`):n.error(`Fresh migration failed`,`Unknown error`),await t(),process.exit(1)}};export{o as default};
//# sourceMappingURL=migrate-fresh.mjs.map