Database Schema Modelling


Database Modelling with XgeneCloud's API framework is done via a GUI database client which is much like MySQL workbench / PG Admin / SQL Server studio etc. This means there is no need to read a tonne of documentation on how to create a table or a foreign key or adding a complex index to table.

Just point and click.

On each change to database schema
  • There will be a timestamp.up.sql and timestamp.down.sql files that will be created under folder ./server/tool/primary/migrations
  • .up.sql file will have the SQL change done to database and this change can be easily applied to other environments
  • .down.sql file will have the reverse schema migration change. For eg : If you created a table - .down.sql file will have delete table statement

Scaffold Code on Save
If Scaffold code on save is enabled - any change done to schema will get result in a scaffolding of respective source code
  • On new table creation : model files, router files, service files will be generated
  • On table edit : model files will be regenerated and the orginial file will be backed up with a timestamp
  • On table delete : we don't change any source code as of now

Models are kept under /server/models/primary folder. Where model files suffixed with .model.js and meta files suffixed with .meta.js.

An example for model file which is generated for city table in sakila database.

An example for meta file which is generated for city table in sakila database.

For more about Model API click here .

Creating Models

Creating models

Editing Models

Deleting Models

Scaffolding On Change

Subscribe to Our Newsletter

Let us stretch your imagination

Download App