diff --git a/app/Models/PrelimScoreSheet.php b/app/Models/PrelimScoreSheet.php new file mode 100644 index 0000000..d81fd71 --- /dev/null +++ b/app/Models/PrelimScoreSheet.php @@ -0,0 +1,19 @@ +hasOne(User::class); + } + + public function entry(): HasOne + { + return $this->hasOne(Entry::class); + } +} diff --git a/database/migrations/2025_09_23_020626_create_prelim_score_sheets_table.php b/database/migrations/2025_09_23_020626_create_prelim_score_sheets_table.php new file mode 100644 index 0000000..a1cc58a --- /dev/null +++ b/database/migrations/2025_09_23_020626_create_prelim_score_sheets_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignIdFor(User::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->foreignIdFor(Entry::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->json('subscores'); + $table->decimal('total', 9, 6); + $table->timestamps(); + $table->unique(['user_id', 'entry_id']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('prelim_score_sheets'); + } +};