Titanium JIRA Archive
Alloy (ALOY)

[ALOY-407] Make "alloy generate model" calls uniform in format, regardless of adapter

GitHub Issuen/a
Resolution Date2013-01-28T16:52:41.000+0000
Affected Version/sAlloy 0.3.3
Fix Version/sAlloy 1.0.0, 2013 Sprint 02
ComponentsTitanium SDK
ReporterTony Lukasavage


update (1/28/2013)

The CLI format of the generate command for models will be kept the same except for one change. The second argument that specified the adapter type is now required. Before you could do this:
alloy generate model myModel col1:text col2:integer
and it would automatically use the sql adapter. To avoid confusion, it is now required that you explicitly list the adapter type, like this:
alloy generate model myModel sql col1:text col2:integer
*NOTE:* At the time of this update, this will have no adverse effect on the TiStudio integration as TiStudio always explicitly lists the adapter type. Also, there appears to be no reference to the automatically assigned adapter type in the docs.


Currently 2 of the 3 adapters for which models can be generated (properties and localStorage) abide by a similar format:
alloy generate model NAME col1:type1 col2:type2 ...
the sql adapter however behaves slightly differently if you specify the "sql" adapter explicitly in the argument list:
alloy generate model NAME sql  col1:type1 col2:type2 ...
This will create a sql adapter, and will only create a migration (necessary for execution) if the "sql" is put in there explicitly. Also, since the sql adapter generation is not uniform with the other commands, it causes issues when generating models for sql through TiStudio, as detailed in ALOY-375. We need to create a standard, uniform method for creating models based on adapters. Anything that deviates from the standard should be captured in options/flags, not additional arguments. For example:
alloy generate model MyModel col1:string col2:int --adapter sql


  1. Tony Lukasavage 2013-01-28

    relevant changes in the *update* section of the description

JSON Source