Telosys doc
WebsiteTwitterLinkedInNews
  • Telosys documentation
  • Telosys CLI
    • Installation on Linux
    • Installation on Windows
    • CLI configuration
    • CLI commands
    • Getting started
  • Telosys with VSCode
    • Extension installation
    • VSCode settings
    • Telosys terminal in VSCode
    • Telosys editor configuration
  • Telosys with JetBrains IDE
  • Project configuration
  • Project variables
  • Project databases
  • Models and entities
    • Model structure
    • Entity
    • Attribute / Link
    • Annotations
    • Tags
    • Examples
    • Model creation
    • Model installation
    • Models management
  • Bundles of templates
    • Bundle structure
    • Bundle creation
    • Bundles installation
    • Bundles management
    • Velocity language
    • Velocity directives
    • Velocity object types
    • Telosys directives
    • Telosys variables
    • Telosys objects
    • Code snippets
  • Code generation
    • "gen" command
    • "genb" command
  • Target languages
    • C++
    • C#
    • Golang
    • Java
    • JavaScript
    • Kotlin
    • PHP
    • Python
    • Scala
    • TypeScript
  • Target databases (SQL)
    • Predefined rules
    • Specific rules
    • Type size and precision
  • Telosys with Git
    • GitHub usage
    • Install with Git
    • Publish with Git
  • Support the project
  • How to contribute
  • Sponsors
  • IDE and editors
  • Telosys 3 Eclipse plugin
    • Eclipse plugin installation
    • Eclipse customization
    • Telosys 3 database model
Powered by GitBook
On this page

Target databases (SQL)

PreviousTypeScriptNextPredefined rules

Last updated 5 months ago

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:

  • using

  • using

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

predefined rules
specific rules