Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
26 lines
710 B
Plaintext
26 lines
710 B
Plaintext
/**
|
|
* Gets all existing migrations from the database, excluding the dev migration
|
|
*/ export async function getMigrations({ payload }) {
|
|
const migrationQuery = await payload.find({
|
|
collection: 'payload-migrations',
|
|
limit: 0,
|
|
sort: [
|
|
'-batch',
|
|
'-name'
|
|
],
|
|
where: {
|
|
batch: {
|
|
not_equals: -1
|
|
}
|
|
}
|
|
});
|
|
const existingMigrations = migrationQuery.docs;
|
|
// Get the highest batch number from existing migrations
|
|
const latestBatch = Number(existingMigrations?.[0]?.batch) || 0;
|
|
return {
|
|
existingMigrations,
|
|
latestBatch
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=getMigrations.js.map |