agent-nodejs icon indicating copy to clipboard operation
agent-nodejs copied to clipboard

Add the possibility to exclude a table absent

Open amaurycoudr opened this issue 11 months ago • 2 comments

We would like to exclude _prisma_migrations because, in a local environment, the table is not always present, causing the generated files to change for no valid reason. However, we encountered this error:

"Collection '_prisma_migrations' not found. List of available collections."

Would it be possible to allow optionally absent tables in the exclude field like this?

.addDataSource(createSqlDataSource("database.url"), {
    exclude: ["_prisma_migrations"],
})

amaurycoudr avatar Feb 17 '25 15:02 amaurycoudr

Hello, Could you detect your local environment by getting the env.NODE_ENV and adding a condition in the exclude property?

For example:

.addDataSource(createSqlDataSource("database.url"), {
    exclude: env.NODE_ENV === 'dev' ? ["_prisma_migrations"] : [],
})

Scra3 avatar Feb 17 '25 21:02 Scra3

The issue is that in development, the table is not always present, so this approach wouldn’t work. So, it introduces unnecessary changes to the generated files.

amaurycoudr avatar Feb 19 '25 09:02 amaurycoudr