2022-11-25 19:39:51 -05:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
|
2024-06-03 08:18:35 -04:00
|
|
|
final class AddTestsTable extends AbstractMigration {
|
|
|
|
|
|
|
|
public function change(): void {
|
|
|
|
$table = $this->table('tests');
|
|
|
|
$table->addColumn('title', 'string', ['null' => false])
|
|
|
|
->addColumn('description', 'string')
|
|
|
|
->addColumn('component_id', 'integer', ['null' => false])
|
|
|
|
->addForeignKey('component_id', 'components', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
|
|
|
|
->addTimestamps()
|
|
|
|
->create();
|
2024-06-03 08:22:09 -04:00
|
|
|
|
2024-06-03 09:43:33 -04:00
|
|
|
$table = $this->table('test_benchmark');
|
2024-06-03 08:23:06 -04:00
|
|
|
$table->addColumn('test_id', 'integer', ['null' => false])
|
2024-06-03 08:22:09 -04:00
|
|
|
->addColumn('benchmark_id', 'integer', ['null' => false])
|
2024-06-03 08:23:06 -04:00
|
|
|
->addForeignKey('test_id', 'tests', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
|
2024-06-03 08:22:09 -04:00
|
|
|
->addForeignKey('benchmark_id', 'benchmarks', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE'])
|
|
|
|
->create();
|
2024-06-03 08:18:35 -04:00
|
|
|
}
|
2022-11-25 19:39:51 -05:00
|
|
|
|
|
|
|
}
|