From 6eaf7a0ba92232d68ffa98fe2523d90176f56c22 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Mon, 3 Jun 2024 08:22:09 -0400 Subject: [PATCH] Added many-to-many relationship table for tests and benchmarks --- db/migrations/20230923020649_add_tests_table.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/migrations/20230923020649_add_tests_table.php b/db/migrations/20230923020649_add_tests_table.php index 03a947c..b08be03 100644 --- a/db/migrations/20230923020649_add_tests_table.php +++ b/db/migrations/20230923020649_add_tests_table.php @@ -13,6 +13,14 @@ final class AddTestsTable extends AbstractMigration { ->addForeignKey('component_id', 'components', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE']) ->addTimestamps() ->create(); + + // many-to-many relationship with benchmarks + $table = $this->table('tests_benchmarks'); + ->addColumn('component_id', 'integer', ['null' => false]) + ->addColumn('benchmark_id', 'integer', ['null' => false]) + ->addForeignKey('component_id', 'components', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE']) + ->addForeignKey('benchmark_id', 'benchmarks', 'id', ['delete'=> 'CASCADE', 'update'=> 'CASCADE']) + ->create(); } }