UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 849 B
import e from"../repositories/collection-migrations.mjs";import t from"../../utils/services/service-wrapper.mjs";import n from"./migration/build-migrations.mjs";const r=t(async(t,r)=>{let i=await n(t,{migrationPlan:[r.migrationPlan]});if(i.error)return i;let a=await new e(t.db.client,t.config.db).createSingle({data:r.migrationEntry});return a.error?a:{data:void 0,error:void 0}},{transaction:!0}),i=async(e,t)=>{let n=t.collections.map(({inferredSchema:e,migrationPlan:t})=>{let n=Object.fromEntries(e.tables.map(e=>[e.name,e.rawName??e.name]));return{migrationPlan:t,migrationEntry:{collection_key:e.key,table_name_map:JSON.stringify(n),migration_plans:t,collection_schema:e}}});for(let t of n){let n=await r(e,t);if(n.error)return n}return{data:void 0,error:void 0}};export{i as default}; //# sourceMappingURL=apply-collection-migrations.mjs.map