Target databases (SQL)

With Telosys you can generate SQL scripts to manage your database (create table, drop table, foreign key definition, etc).

As SQL statements may differ depending on the type of database you are targeting, Telosys has a configuration system that allows the generated SQL to be adapted to the target database.

This can be done in 2 ways:

Database customization behavior

If no rules have been defined (neither predefined nor specific), then the "ANSI-SQL" will be used by default.

If you have defined both predefined rules and specific rules, the specific rules will apply (the more specific takes precedence).

Whatever your rules definition, if an entity or an attribute has database annotations in the model (@DbName, @DbType, @DbTable, etc) those annotations will be used first.

In the templates the database configuration has an influence on:

  • $entity.sqlTableName

  • $entity.sqlPrimaryKeyColumns

  • $entity.sqlPrimaryKeyColumnsAsString

  • $attribute.sqlColumnName

  • $attribute.sqlColumnType

  • $attribute.sqlColumnConstraints

  • $fk.sqlName

  • $fk.sqlOriginTableName

  • $fk.sqlOriginColumns

  • $fk.sqlOriginColumnsAsString

  • $fk.sqlReferencedTableName

  • $fk.sqlReferencedColumns

  • $fk.sqlReferencedColumnsAsString

  • $sql object

Last updated