23 lines
		
	
	
		
			745 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			745 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
declare(strict_types=1);
 | 
						|
 | 
						|
use Phinx\Migration\AbstractMigration;
 | 
						|
 | 
						|
final class AddResultsTable extends AbstractMigration {
 | 
						|
 | 
						|
  public function change(): void {
 | 
						|
    // benchmark test results
 | 
						|
    $table = $this->table('results');
 | 
						|
    $table->addColumn('average', 'integer', ['null' => false])
 | 
						|
      ->addColumn('minimum', 'integer')
 | 
						|
      ->addColumn('maximum', 'integer')
 | 
						|
      ->addColumn('test_id', 'integer', ['null' => false])
 | 
						|
      ->addColumn('benchmark_id', 'integer', ['null' => false])
 | 
						|
      ->addForeignKey('test_id', 'tests', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
 | 
						|
      ->addForeignKey('benchmark_id', 'benchmarks', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
 | 
						|
      ->addTimestamps()
 | 
						|
      ->create();
 | 
						|
  }
 | 
						|
 | 
						|
}
 |