“Laravel DB Drop Table” Respostas de código

reversão de migração de Laravel

To rollback one step:

php artisan migrate:rollback

To rollback multiple steps:

php artisan migrate:rollback --step=[x]
  
To drop all tables and reload all migrations:

php artisan migrate:fresh
Angry Albatross

mesa de gota de artesão php

php artisan make:migration drop_name_table
Super Starling

Laravel DB Drop Table

//Get all the table names
$all_table_names = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();

foreach ($all_table_names as $name) {
    //if you don't want to truncate migrations in Database
    if ($name == 'migrations') {
        continue;
    }
    DB::table($name)->truncate();
}
Innocent Ibis

migração de mesa de gota de laravel

Schema::drop('users');

Schema::dropIfExists('users');
Alberto Peripolli

Laravel DB Drop Table

foreach(\DB::select('SHOW TABLES') as $table) {
    $all_table_names = get_object_vars($table);
    \Schema::drop($all_table_names[key($all_table_names)]);
}
Innocent Ibis

Respostas semelhantes a “Laravel DB Drop Table”

Perguntas semelhantes a “Laravel DB Drop Table”

Mais respostas relacionadas para “Laravel DB Drop Table” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código