I ran php artisan migrate:rollback on command line, so the migration deleted ALL TABLES in db.
There is only one migration created but have others tables in used db
The laravel documentation says: "To drop an existing table, you may use the drop or dropIfExists methods."
and the function down() on migration code is the default like as bellow:
public function up()
{
Schema::create('products', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('image')->unsigned()->nullable();
$table->string('name', 64);
$table->string('slug', 64)->unique();
$table->integer('price')->unsigned();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('products');
}
}
I don't think the Schema::dropIfExists('products')
work properlly in this case, this is a bug? or my(and laravel documentation) mistake?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire