Schema::table('posts', function (Blueprint $table) {
$table->dropForeign(['category_id']);
});
public function down()
{
Schema::table('tarefas', function (Blueprint $table) {
$table->dropForeign('tarefas_user_id_foreign');
$table->dropColumn('user_id');
});
}
$table->dropForeign('posts_user_id_foreign');
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
// Primary table name, from Schema::table(<table>)
// Primary column, from $table->foreign(<column>)
$table->dropForeign('<table>_<column>_foreign');
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');
});
}
}
// Searched, laravel drop foreign column
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['votes', 'avatar', 'location']);
});
$table->dropIndex(['state']); // Drops index 'geo_state_index'
$table->dropPrimary('users_id_primary');
Schema::table('clients', function (Blueprint $table) {
$table->string('UserDomainName');
});