mercredi 17 février 2016

Schema Builder : Create Table if not exists

I am using below code in Schema Builder to create table.

Schema::create('tblCategory', function (Blueprint $table) {
    $table->increments('CategoryID');
    $table->string('Category', 40);
    $table->unique('Category', 'tblCategory_UK_Category');
    $table->timestamps();
});

Here is the problem is, if I have to create the new table, all old scripts runs and show error that table already exists.

is there any way to create table if not exists using Schema builder ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire