Reputation: 975
I am developing an iOS app using Titanium Appcelerator and using the Alloy Framework. I have run the following command and generated a migration file (20120926011253_User.js) in my app/migrations folder:
alloy generate model User sql name:string phone:string gender:string last_updated:datetime
How can I run this migration and actually create the tables in the SQLite db? I couldn't find how to do this online and have tried the commands I could think of. Thank you!
Upvotes: 1
Views: 2752
Reputation: 51
You dont have to worry about running migrations. After you generate model+migration files and compile ,alloy takes care of running migration when you start your app.
see these generated files to get a better idea : /Resources/alloy/model/*.js for the generated models. In these files, alloy calls MODEL.M function,which is defined in in /Resources/alloy.js.
MODEL.M calls beforeModelCreate,which in turn calls InitAdapter,which is where the DB is inited. the default DB that alloy uses is '_alloy_' for each app.
Upvotes: 5