Skip to content

Commit 989dd8a

Browse files
feat: add check to global setup (#714)
* feat: add check to global setup * Update tests/setup/global-setup.ts --------- Co-authored-by: Kent C. Dodds <[email protected]>
1 parent 7b77751 commit 989dd8a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/setup/global-setup.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@ export const BASE_DATABASE_PATH = path.join(
99

1010
export async function setup() {
1111
const databaseExists = await fsExtra.pathExists(BASE_DATABASE_PATH)
12-
if (databaseExists) return
12+
13+
if (databaseExists) {
14+
const databaseLastModifiedAt = (await fsExtra.stat(BASE_DATABASE_PATH))
15+
.mtime
16+
const prismaSchemaLastModifiedAt = (
17+
await fsExtra.stat('./prisma/schema.prisma')
18+
).mtime
19+
20+
if (prismaSchemaLastModifiedAt < databaseLastModifiedAt) {
21+
return
22+
}
23+
}
1324

1425
await execaCommand(
1526
'npx prisma migrate reset --force --skip-seed --skip-generate',

0 commit comments

Comments
 (0)