Include drizzle migrations in bundle
HI i want to have a migrator that runs on startup inside nitro context with drizzleorm migrate function it expects a path to migration dir what is the best way to include the sql migration folder as is inside the bundle so i do not need to change the path inside the nitroPlugin
ive looked at nito serverAssets but those bundle into flat .mjs files
2 Replies
Hi @Kilisei. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the knowledge sources do not contain explicit information about how to include a SQL migration folder (such as for Drizzle ORM) inside a Nitro bundle so that you can reference it by path at runtime within a Nitro plugin.
However, there are some related discussions about bundling and externalizing dependencies in Nitro/Nuxt, especially for cases like Prisma, where native binaries or additional files need to be included in the output. The recommended approach in those cases is to use Nitro's configuration options such as externals, inline, or traceInclude, but there is no direct mention of handling static folders like SQL migrations for Drizzle ORM. In a similar issue, it was suggested to open an issue in the Nitro repository if you encounter problems with including such files, as this may not be fully supported out of the box yet Don't bundle a dependency / Incomplete bundle.
If you need to ensure a folder is present in the output, you may need to use a custom Nitro plugin or build step to copy the migrations directory into the output directory, but this is not documented in the provided sources.
In summary:
The knowledge sources do not provide a documented or recommended way to include a SQL migration folder in the Nitro bundle for use with Drizzle ORM migrations. You may need to explore custom build steps or raise an issue in the Nitro repository for further guidance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
The knowledge sources do not provide a documented or recommended way to include a SQL migration folder in the Nitro bundle for use with Drizzle ORM migrations. You may need to explore custom build steps or raise an issue in the Nitro repository for further guidance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@569531317306261515> Kapa.ai is still learning and improving, please let me know how I did by reacting below.