<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddInitialTables extends AbstractMigration {

  public function change(): void {
    // hardware components
    $components_table = $this->table('components');
    $components_table->addColumn('name', 'string', ['null' => false])
      ->addColumn('type', 'string', ['null' => false])
      ->addTimestamps()
      ->addIndex(['name', 'type'])
      ->create();

    // benchmarks
    $benchmarks_table = $this->table('benchmarks');
    $benchmarks_table->addColumn('name', 'string', ['null' => false])
      ->addColumn('description', 'string')
      ->addColumn('scoring', 'string', ['null' => false])
      ->addTimestamps()
      ->addIndex(['name', 'scoring'])
      ->create();
  }

}