laravel tables

 add column

move from old column to new column

drop column

rename column

Laravel tip. When typing `make:migration` command, you usually use underscore symbol between parts, like `create_transactions_table`. But, alternatively, you can also put the name in quotes and use a SPACE as a delimiter.





how to remove cloumn with new migration file

how to craete
public function up(): void { Schema::table('settings_site', function (Blueprint $table) { $table->string('retailer_signatory')->nullable(); }); Schema::table('delivery_locations', function (Blueprint $table) { $table->dropColumn('test'); }); } write down method for this


what is down method for this

use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class UpdateSiteSettingsAndDeliveryLocations extends Migration { public function up() { Schema::table('settings_site', function (Blueprint $table) { $table->string('retailer_signatory')->nullable(); }); Schema::table('delivery_locations', function (Blueprint $table) { $table->dropColumn('test'); }); } public function down() { Schema::table('settings_site', function (Blueprint $table) { $table->dropColumn('retailer_signatory'); }); Schema::table('delivery_locations', function (Blueprint $table) { $table->string('test')->nullable(); }); } }


====================
$table->string('retailer_signatory')->nullable()->change();


what is the down method fo rthis

$table->string('retailer_signatory')->nullable()->change();

$table->string('retailer_signatory')->nullable(false)->change();


==




No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...