Create table for etudes

This commit is contained in:
Matt Young 2025-12-16 21:48:05 -06:00
parent f5a3cc0f43
commit 385810806a
4 changed files with 64 additions and 2 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class AuditionEtude extends Model
{
protected $fillable = [
'instrument_id', 'auditioned_ensemble_id', 'set', 'original_filename', 'file_path', 'file_size',
];
public function instrument(): BelongsTo
{
return $this->belongsTo(Instrument::class);
}
public function auditionedEnsemble(): BelongsTo
{
return $this->belongsTo(AuditionedEnsemble::class);
}
}

View File

@ -6,5 +6,7 @@ use Illuminate\Database\Eloquent\Model;
class AuditionedEnsemble extends Model class AuditionedEnsemble extends Model
{ {
// protected $fillable = [
'name', 'set_count',
];
} }

View File

@ -6,5 +6,7 @@ use Illuminate\Database\Eloquent\Model;
class Instrument extends Model class Instrument extends Model
{ {
// protected $fillable = [
'instrument', 'score_order',
];
} }

View File

@ -0,0 +1,35 @@
<?php
use App\Models\AuditionedEnsemble;
use App\Models\Instrument;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('audition_etudes', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Instrument::class)->constrained()->cascadeOnDelete();
$table->foreignIdFor(AuditionedEnsemble::class)->constrained()->cascadeOnDelete();
$table->integer('set');
$table->string('file_path');
$table->string('original_filename')->nullable();
$table->unsignedBigInteger('file_size')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('audition_etudes');
}
};