Skip to content

Porting existing applications to sql mvc

Lafras edited this page Jan 8, 2015 · 5 revisions

*this presumes it was a Firebird database or more database drivers have been added.

##The main porting issue is ensuring the integrity and automation of the update process of deployed to production databases.

One of SQL-MVC goals is to to implement the DRY principle, in systems where SQL-MVC is the "master" the upgrade of production databases are almost completely automated, but when parts of the schema is defined by other sources, the ability to automate is compromised.

##Porting work flow

  1. set the database scheme maintenance mode.

  2. when compiling quicc will create a reflection.sql file containing the raw database model. It is a good idea to keep this file under version control, it also places a every change in the audit directory.

  3. add the contents of this file to the models/common.quicc file add < pre process=sql > as the opening line.

  4. To start with your model has very little/no qualia, so add some....

  5. Examine your use / naming patterns especially is you have used domains(data types ) add regex qualia where you can match patterns,

  6. Examine the tables and their associated objects you are going to be working with first per field add in explicit field qualia per field.

  7. Move the tables you are working with to their own quicc model files. start pulling the file apart and into modules

  8. as you do this, occasionally re-compile the application (even though you have not coded it yet), quicc will compile the model and update the reflection.sql, check this with diff to monitor the progress and changes as they occur.

  9. At some point you will have enough models and qualia set, to start working on controllers and views.

  10. Start with a home page, add some menu pages.

  11. Write a SQL queries to produce the views, write/move business logic into the controllers, and use them from the views.

  12. develop and test your application

##variances based on intent

  • rewrite - If your intention is to totally or mostly rewrite your existing application, then you will want to use the maintenance "master" mode and import the entire scheme like in the above work flow.
  • reuse If your intention is to use sql-mvc to provide a web interface (or replace (part of) the web interface) only for a (small) part of your application then you may want to keep maintaining the scheme using your existing methods, thus set the maintenance mode to "slave" , you will just move and qual-ify part of the
    reflection.sql file .
  • Extend If your intention is to add new tables and functionality, to an existing application choose "shared" mode, you will reuse some tables like above, but new ones will be added using the model.