move database initializer to new
command
#521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
This addresses issue https://github.com/amberframework/granite-orm/issues/107
This moves the database initializer to
new
. There were several users that did not use generators and either copied their models over or created them by hand. The initializer was not generated for them so it created confusion.Alternate Designs
The original thought was that if someone didn't want to use a database, then we shouldn't generate the initializer. However since the
new
command already assumes an MVC model, it makes sense that this initializer should be created on new instead of when a model is generated.Benefits
This also eliminates some duplicate code between
auth
andmigrate
.Possible Drawbacks
If the developer doesn't want to use granite or crectco, an extra file is generated that they will need to remove or change.