original_string: protected function createTable(SchemaAsset $schema, ModelInterface $model)
      {
          $table = $schema->createTable($this->quoteIdentifier($model->table()));
  
          foreach ($model->fields() as $field) {
              $table->addColumn(
                  $this->quoteIdentifier($field->mappedName()),
                  $field->type(),
                  $field->attributes()
              );
          }
  
          foreach ($model->indexes() as $index) {
              switch ($index->type()) {
                  case 'primary':
                      $table->setPrimaryKey(
                          $this->quoteIdentifier($index->fields()),
                          $this->quoteIdentifier($index->name())
                      );
                      break;
                  case 'unique':
                      $table->addUniqueIndex(
                          $this->quoteIdentifier($index->fields()),
                          $this->quoteIdentifier($index->name())
                      );
                      break;
                  case 'foreign':
                      $table->addForeignKeyConstraint(
                          $index->table(),
                          $this->quoteIdentifier(array_keys($index->fields())),
                          $this->quoteIdentifier(array_values($index->fields())),
                          ['onUpdate' => 'CASCADE', 'onDelete' => 'RESTRICT'],
                          $this->quoteIdentifier($index->name())
                      );
                      break;
                  case 'index':
                  default:
                      $table->addIndex(
                          $this->quoteIdentifier($index->fields()),
                          $this->quoteIdentifier($index->name())
                      );
              }
          }
      }
code: protected function createTable(SchemaAsset $schema, ModelInterface $model)
      {
          $table = $schema->createTable($this->quoteIdentifier($model->table()));
  
          foreach ($model->fields() as $field) {
              $table->addColumn(
                  $this->quoteIdentifier($field->mappedName()),
                  $field->type(),
                  $field->attributes()
              );
          }
  
          foreach ($model->indexes() as $index) {
              switch ($index->type()) {
                  case 'primary':
                      $table->setPrimaryKey(
                          $this->quoteIdentifier($index->fields()),
                          $this->quoteIdentifier($index->name())
                      );
                      break;
                  case 'unique':
                      $table->addUniqueIndex(
                          $this->quoteIdentifier($index->fields()),
                          $this->quoteIdentifier($index->name())
                      );
                      break;
                  case 'foreign':
                      $table->addForeignKeyConstraint(
                          $index->table(),
                          $this->quoteIdentifier(array_keys($index->fields())),
                          $this->quoteIdentifier(array_values($index->fields())),
                          ['onUpdate' => 'CASCADE', 'onDelete' => 'RESTRICT'],
                          $this->quoteIdentifier($index->name())
                      );
                      break;
                  case 'index':
                  default:
                      $table->addIndex(
                          $this->quoteIdentifier($index->fields()),
                          $this->quoteIdentifier($index->name())
                      );
              }
          }
      }
code_tokens: protected function createTable ( SchemaAsset $ schema , ModelInterface $ model ) { $ table = $ schema -> createTable ( $ this -> quoteIdentifier ( $ model -> table ( ) ) ) ; foreach ( $ model -> fields ( ) as $ field ) { $ table -> addColumn ( $ this -> quoteIdentifier ( $ field -> mappedName ( ) ) , $ field -> type ( ) , $ field -> attributes ( ) ) ; } foreach ( $ model -> indexes ( ) as $ index ) { switch ( $ index -> type ( ) ) { case 'primary' : $ table -> setPrimaryKey ( $ this -> quoteIdentifier ( $ index -> fields ( ) ) , $ this -> quoteIdentifier ( $ index -> name ( ) ) ) ; break ; case 'unique' : $ table -> addUniqueIndex ( $ this -> quoteIdentifier ( $ index -> fields ( ) ) , $ this -> quoteIdentifier ( $ index -> name ( ) ) ) ; break ; case 'foreign' : $ table -> addForeignKeyConstraint ( $ index -> table ( ) , $ this -> quoteIdentifier ( array_keys ( $ index -> fields ( ) ) ) , $ this -> quoteIdentifier ( array_values ( $ index -> fields ( ) ) ) , [ 'onUpdate' => 'CASCADE' , 'onDelete' => 'RESTRICT' ] , $ this -> quoteIdentifier ( $ index -> name ( ) ) ) ; break ; case 'index' : default : $ table -> addIndex ( $ this -> quoteIdentifier ( $ index -> fields ( ) ) , $ this -> quoteIdentifier ( $ index -> name ( ) ) ) ; } } }
docstring: Creates table from model into schema
  
  @param SchemaAsset    $schema
  @param ModelInterface $model
docstring_tokens: Creates table from model into schema