Test scenario attempting to truncate deleted table

I started using scenarios for testing, and was running into a problem where RW was attempting to truncate a table that I had deleted prior to running the scenario tests.

I was seeing this error about the CreditPack table, which no longer existed:

Invalid `prisma.$executeRawUnsafe()` invocation:

Raw query failed. Code: `42P01`. Message: `relation "CreditPack" does not exist`

CreditPack was nowhere in the source code, but I eventually realized that it was referenced in .redwood/scenarioTeardown.json. Once I removed that file, the error went away. Not sure if there is a better way to resolve this kind of issue.

I’ve had to delete or edit that file when deleting a table as well. Easy fix for what should be an infrequent case…but tricky for a new user.

Ha, I guess I forgot about this and ran into it again only to find my own post. Would be great if a. the error message was useful in any way and b. if there was a better way of resolving than deleting that file.

@Grayson That’s a great tip. Yes, there is a case where sometime the teardown list of tables can get out of sync if the table is deleted out from under. That’s the place to tidy up manually if that happens.

Thanks and welcome to the RedwoodJS community!