fix(db-*): migrate:reset executes in a wrong order (#12445)
fixes https://github.com/payloadcms/payload/issues/12442
This commit is contained in:
@@ -28,6 +28,8 @@ export async function migrateReset(this: DrizzleAdapter): Promise<void> {
|
||||
|
||||
const req = await createLocalReq({}, payload)
|
||||
|
||||
existingMigrations.reverse()
|
||||
|
||||
// Rollback all migrations in order
|
||||
for (const migration of existingMigrations) {
|
||||
const migrationFile = migrationFiles.find((m) => m.name === migration.name)
|
||||
|
||||
@@ -21,6 +21,8 @@ export async function migrateReset(this: BaseDatabaseAdapter): Promise<void> {
|
||||
|
||||
const req = await createLocalReq({}, payload)
|
||||
|
||||
migrationFiles.reverse()
|
||||
|
||||
// Rollback all migrations in order
|
||||
for (const migration of migrationFiles) {
|
||||
// Create or update migration in database
|
||||
|
||||
Reference in New Issue
Block a user