-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Scan Plugins Models & Migrations #63
Comments
Can you be a bit more specific about what you are looking to be able to do? The plugin does currently support using models and performing migrations. Are you looking for a more integrated approach? |
I hope he can support the models and migration folders in the plugin. |
Model and Migrations folders are both supported through this plugin. The directory for both of these is not automatically generated, which might be what your request is, but the support is there. |
Maybe my expression is not very good Is he able to find models and migrations for other plugins?
|
AH! I see what you are saying and I can see the use cases. My concern with directly pulling in models and migrations from the I think the best approach might be to have the plugin inject models and migrations into the project during installation. The plugin would not have to "eject" the entire model, it could just be a hook that gets ejected, but that would at least give an easy point for a dev to override the model or migrations. Example: // migrations/20181002162429-example-plugin.js
const migration = require('example-ah-plugin').migration
module.exports = migration // models/examplePlugin.js
const models = require('example-ah-plugin').models
module.exports = models @evantahler, any insights you can provide? Has something similar come up with other plugins previously? |
I would suggest looking at how Rails handles plugins with migrations for inspiration. We would need a mechanism which allows developers to opt-into a plugin's migrations, rather than have them run automatically. If we made it so that migrations directories could have sub-folders, we could just symlink in the plugin's migrations? |
This is just my idea
|
@kudorori, that would certainly work for the configuration portion. The migrations might be able to stay in place if sequelize/umzug#106 can get resolved, otherwise we'll either have to do symlinks (which as a Windows user I have a strong distrust of) or running umzug for each plugin directory (which I'm not entirely certain will even work). We perform the model loading ourselves, so that's easy enough to override to look into the plugins directories and find the models that need to be pulled in. The only thing I'm not seeing a solution for is overriding the plugin. I know most plugins don't have extensive overriding short of configuration, so I might be overthinking this a bit. I'm thinking of the use-case of an ACL plugin that would have a core |
sort of similar, i wonder if it might be possible to update ah-sequelize so it accepts a config folder (defaulting to project root) for where to find models and migrations? Im potentially looking at building a repo that has two separate action hero backends in it, but shares models. Two services that connect to a single db. |
I'll work on a fix this weekend. |
I've pushed some changes to the The one caveat to this approach is that each |
Issued closed by PR #65. Solution is to use |
I hope I can support the models and migrations in the plugin. I can open a PR if needed.
The text was updated successfully, but these errors were encountered: