36 lines
693 B
PHP
36 lines
693 B
PHP
<?php
|
|
|
|
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
|
|
{
|
|
DB::statement('
|
|
CREATE VIEW doubler_entry_counts AS
|
|
SELECT
|
|
e.event_id,
|
|
ent.student_id,
|
|
COUNT(*) as entry_count
|
|
FROM entries ent
|
|
JOIN auditions e ON e.id = ent.audition_id
|
|
GROUP BY e.event_id, ent.student_id
|
|
HAVING COUNT(*) > 1
|
|
');
|
|
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
//
|
|
}
|
|
};
|