| 123456789101112131415161718192021222324252627 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Support\Facades\DB;
- return new class extends Migration
- {
- public function up(): void
- {
- DB::statement('DROP VIEW IF EXISTS responsibles_view');
- DB::statement(<<<'SQL'
- CREATE VIEW responsibles_view AS
- SELECT
- r.*,
- a.id AS area_id,
- a.name AS area_name
- FROM responsibles r
- LEFT JOIN areas a ON a.responsible_id = r.id AND a.deleted_at IS NULL
- SQL);
- }
- public function down(): void
- {
- DB::statement('DROP VIEW IF EXISTS responsibles_view');
- }
- };
|