Shipment dashboard changes
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('shipment_items', function (Blueprint $table) {
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'ctn')) {
|
||||
$table->integer('ctn')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'qty')) {
|
||||
$table->integer('qty')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'ttl_qty')) {
|
||||
$table->integer('ttl_qty')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'cbm')) {
|
||||
$table->double('cbm')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'ttl_cbm')) {
|
||||
$table->double('ttl_cbm')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'kg')) {
|
||||
$table->double('kg')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'ttl_kg')) {
|
||||
$table->double('ttl_kg')->default(0);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('shipment_items', 'ttl_amount')) {
|
||||
$table->double('ttl_amount')->default(0);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('shipment_items', function (Blueprint $table) {
|
||||
// safely remove columns (optional)
|
||||
$columns = [
|
||||
'ctn', 'qty', 'ttl_qty', 'cbm',
|
||||
'ttl_cbm', 'kg', 'ttl_kg', 'ttl_amount'
|
||||
];
|
||||
|
||||
foreach ($columns as $col) {
|
||||
if (Schema::hasColumn('shipment_items', $col)) {
|
||||
$table->dropColumn($col);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user