Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Laravel Drop All Tables & Migrate

php artisan migrate:fresh

php artisan migrate:fresh --seed
Comment

php artisan drop table

php artisan make:migration drop_name_table
Comment

laravel drop table column

Update Table

migrate:fresh          Drop all tables and re-run all migrations
migrate:install        Create the migration repository
migrate:refresh        Reset and re-run all migrations
migrate:reset          Rollback all database migrations
migrate:rollback       Rollback the last database migration
migrate:status         Show the status of each migration

for specific table
php artisan migrate:refresh --path=/database/migrations/table_name.php
Comment

drop column migration laravel

 Class RemoveCommentViewCount extends Migration
  {
      public function up()
      {
          Schema::table('articles', function($table) {
             $table->dropColumn('comment_count');
             $table->dropColumn('view_count');
          });
      }

      public function down()
      {
          Schema::table('articles', function($table) {
             $table->integer('comment_count');
             $table->integer('view_count');
          });
      }
  }
Comment

laravel drop table migration

Schema::drop('users');

Schema::dropIfExists('users');
Comment

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();
}
Comment

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)]);
}
Comment

delete a migration laravel

// delete a migration safely from laravel 
delete migration from database/migrations/ directory
and also delete entry from migrations table
Comment

delete rows by migration laravel

Comment::where('post_id',$id)->delete();

// in down migration

    public function down()
    {
        Schema::table('package_types', function (Blueprint $table) {
            AppModelsPackageType::query()->where('id','gt',1)->delete();
        });
    }
Comment

drop column laravel migration

Schema::table('clients', function (Blueprint $table) {
    $table->string('UserDomainName');
});
Comment

PREVIOUS NEXT
Code Example
Php :: php date in italiano 
Php :: how to get attachments to emails php 
Php :: wp reserved image size names 
Php :: php loop html select option 
Php :: laravel create model 
Php :: find days with name between two dates in php 
Php :: laravel model with migration 
Php :: check if array is empty php 
Php :: calling fucnction in an other function php 
Php :: include in php 
Php :: laravel url download file 
Php :: include() in php 
Php :: show images laravel 8 showJobImage($filename) 
Php :: laravel carbon time format 
Php :: wp_localize_script 
Php :: doctrine querybuilder print sql 
Php :: php read from mariadb 
Php :: wordpress get product category name by termid 
Php :: copy php array to another 
Php :: laravel DB wherein 
Php :: php cookies 
Php :: insert batch in laravel 
Php :: php remove element from array by value 
Php :: php url parameters 
Php :: start php file 
Php :: laravel timezone 
Php :: laravel number input positive only 
Php :: IlluminateContractsAuthAuthenticatable, AppModelsUser given, called in 
Php :: custom timestamp column laravel 
Php :: php dirpath multiple file extensions 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =