Padrino provides generator support for quickly creating new models within your Padrino application. Note that the models (and migrations) generated are specifically tailored towards the ORM component and testing framework chosen during application generation.
|root||.||-r||specify the root destination path|
|app||.||-a||specify the application destination path|
|skip_migration||false||-s||skip migration generation|
|destroy||false||-d||removes all generated files|
Very important to note that model generators are intended primarily to work within applications created through the Padrino application generator and that follow Padrino conventions. Using model generators within an existing application not generated by Padrino will likely not work as expected.
Using the model generator is as simple as:
$ padrino g model User
You can also specify desired fields to be contained within your
$ padrino g model User name:string age:integer email:string
The model generator will create multiple files within your application and based on your ORM component. Usually the model file will generate files similar to the following:
- Model definition file (
- Migration declaration (
- Model unit test file (
You can define as many models as you would like in a Padrino application using this generator.
You can destroy models that you created via the destroy option and setting it to true. Default is false.
$ padrino g model User -d
This remove all created model files.
last updated: 2016-10-23comments powered by Disqus