Description
Database migrations are great for initializing and seeding production database. I was thinking of expanding migration usage and allow other modules to communicate with migration engine.
Currently, migrations are stored and retrieved from the server/database/migrations
directory. What if NuxtHub provides some hooks that allow other modules to inject migration/seeding queries without the need to create a file in server/database/migrations
directory?
The hook:
nuxthub:database:migrations
: The hook will call with the list of existing migrations and consumers can modify or append to it
Using this hook
- Modules like Nuxt Content can inject migration queries without the need to create the file
- Also this hook is a good place to know the exact timing of when NuxtHub retrieves migrations and creates a custom one (In this case we use this hook to create a migration file in the server directory)
Additionally, it would be awesome NuxtHub could provide a hook to provide a database connection and allow running javascript logic (like strapi migrations) or Nuxt tasks. This is tricky thing to achieve since it should work in different types of deployment.