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
  • Creating a model from scratch
  • Creating a model from a database
  1. Models and entities

Model creation

There are 2 ways to create a Telosys model :

  • creation from scratch to create an empty model in which you can then create the entities you need

  • creation from an existing relational database to create a model from a database with an entity for each table

Creating a model from scratch

Step #1 - Create a void model

To create a model from scratch use the "nm" (New Model) command.

Syntaxe:

nm <model-name>

<model-name> -> the name of the new model to create

This command creates a new model with the given name.

This model is void, it does not contain any entity.

Step #2 - Add entities to the model

To add entities, use the "ne" (New Entity) command.

Syntaxe:

ne <entity-name>

This command creates a new entity with the given name -> a file "entity-name.entity"

You can now edit the ".entity" files of the model with any editor or IDE to define the attributes and links.

You can also "copy/paste" certain files if you have similarities between entities.

Creating a model from a database

If you have a relational database with tables and links based on foreign keys then you have a relationship model. Telosys is able to build its own model from this database model.

Once you have define the database and check the configuration with "cdb" command you can create a Telosys model from this database with the "nm" command.

Syntaxe:

nm <model-name> <database-id>

<model-name> -> the name of the new model to create

<database-id> -> the id of a database defined in "databases.yaml"

An entity will be created for each table matching the patterns defined in the database configuration.

You can check the entities created and if necessary you can customize them by editing the ".entity" files.

PreviousExamplesNextModel installation

Last updated 5 months ago

To do so, you just have to define your database -> see the page ""

Project databases