Add data migration to npm scripts

This commit is contained in:
Jorge Vargas 2025-05-10 00:36:07 -06:00
parent 5c4f46a41e
commit a5fde1b6c8
2 changed files with 6 additions and 3 deletions

View file

@ -20,6 +20,8 @@ const migrations: Migration[] = migrationFiles
.map((id) => ({ id, migrationFn: require(path.join(dataMigrationsPath, id)).default }))
.filter((migration) => migration.migrationFn !== undefined)
if (migrations.length === 0) console.log('No data migrations to run.')
for (const { id, migrationFn } of migrations) {
const startDate = new Date()
const migration = await prismaClient.migration.findFirst({ where: { id } })