Started adding test model/routes/views; removed a bit of the old paradigm with tying results directly to hardware

This commit is contained in:
2025-06-10 17:35:52 -04:00
parent 883019b181
commit 47cb580393
16 changed files with 343 additions and 85 deletions

View File

@ -0,0 +1,39 @@
Sequel.migration do
up do
# create tests table
create_table(:tests) do
primary_key :id
foreign_key :hardware_id, :hardware
String :name, null: false
String :description
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
end
# create many-to-many table between tests and benchmarks
create_table(:benchmarks_tests) do
primary_key :id
foreign_key :benchmark_id, :benchmarks
foreign_key :test_id, :tests
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
end
# modify results table to integrate with the new tests table
alter_table(:results) do
drop_foreign_key :hardware_id
add_foreign_key :test_id, :tests
end
end
down do
alter_table(:results) do
drop_foreign_key :test_id
add_foreign_key :hardware_id, :hardware
end
drop_table(:benchmarks_tests)
drop_table(:tests)
end
end