Support the ongoing development of Laravel.io →
Laravel Database

Hello fellows,

I'd like to request request new methods for creating/deleting views on migration... (cloud you guys put on your roadmap?)

--> OLD way =(

// View with DB::statement

class CreateMyView extends Migration { public function up() { DB::statement("CREATE VIEW my_view..."); } public function down() { DB::statement('DROP VIEW IF EXISTS my_view'); } }

--> NEW way =)

// View with Schema::createView | Schema::dropViewIfExists

class CreateMyView extends Migration { public function up() { Schema::createView('my_view', function (Blueprint $table) { }); } public function down() { Schema::dropViewIfExists('my_view'); } }

Thank you very much guys!

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Jaime Adm jaimeadm Joined 30 Dec 2021

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.