Create table for etudes
This commit is contained in:
parent
f5a3cc0f43
commit
385810806a
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,5 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class AuditionedEnsemble extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = [
|
||||
'name', 'set_count',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,5 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class Instrument extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = [
|
||||
'instrument', 'score_order',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue