jeudi 22 août 2019

Schema::create Vs Sql

I am new with Laravel and started my personal project.

Laravel provide migrations for creating schema for our databases. I have difficulties on implementation choice. The ideas I have are:

  1. Create database schema using Illuminate\Support\Facades\Facade\Schema provided by Laravel, for example:
Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username',300)->unique();
            $table->string('email',300)->unique();
            $table->string('password',100);
})

  1. Create schema using ERD Designer like Mysql Workbench, export the diagram to sql and finally execute the sql in Laravel using DB::statement

I'm trying to google which method is better, but no answer satisfy me.

Which methods is the better or commonly used in industry? If you have any other suggestion I'm happy to know it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire