code: private function buildModel(string $modelName, array $modelDefinition)
      {
          $mapping = Mapping::get($this->mapping);
          $definition = $this->getDefinition();
          $database = GlobalDatabase::get($mapping['config']['database']);
  
          $tableName = null;
          if (isset($modelDefinition['name']) === true) {
              $tableName = $modelDefinition['name'];
          } else {
              $tableName = Helper::codifyName($this->mapping) . '_' . Helper::codifyName($modelName);
          }
  
          if (isset($modelDefinition['fields']) === false) {
              throw new InvalidSchemaDefinition('model "' . $modelName . '" has no field');
          }
          $statement = Mutation\AddTable::statement($database, $this->getDefinition(), $this->mapping, $tableName, $modelName);
          if ($statement->execute() == false) {
              throw new DatabaseError('db/build : ' . print_r($statement->errorInfo(), true));
          }
  
          if (isset($modelDefinition['indexes']) === true) {
              foreach ($modelDefinition['indexes'] as $indexName => $indexDefinition) {
                  $statement = Mutation\AddIndex::statement($database, $modelName, $tableName, $modelDefinition, $indexName);
                  if ($statement->execute() == false) {
                      throw new DatabaseError('db/build : ' . print_r($statement->errorInfo(), true));
                  }
              }
          }
  
          if (isset($modelDefinition['uniques']) === true) {
              foreach ($modelDefinition['uniques'] as $uniqueName => $uniqueDefinition) {
                  $statement = Mutation\AddUnique::statement($database, $modelName, $tableName, $modelDefinition, $uniqueName);
                  if ($statement->execute() == false) {
                      throw new DatabaseError('db/build : ' . print_r($statement->errorInfo(), true));
                  }
              }
          }
  
          echo $modelName . ' - Done' . PHP_EOL;
      }
docs: Build a model.
  
  @param string $modelName model alias
  @param array $modelDefinition model definition from a schema file
  @throws DatabaseError           if a SQL query fails
  @throws InvalidSchemaDefinition if a model has no field