I do my DB design first, set up all the fields and foreign keys. Then I connect my factory to this newly created database and the factory creates the application structure based on the relations etc. The factory then uses code templates to generate a fully functioning web app based on Yii (
http://www.yiiframework.com) with MVC, unit and functional tests and most of the boring repetitve work done for you e.g CRUD, search, autocomplete, jqgrid data grids, search engine friendly urls etc. After that it's just a case of adding your business logic and customising the CSS. This is something I'll be releasing in future, probably a lot sooner now that i have more time on my hands