add inventory and supply logic
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('supply_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('supply_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('suppliers', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('suppliers', 'email')) {
|
||||
$table->string('email')->nullable()->after('name');
|
||||
}
|
||||
if (!Schema::hasColumn('suppliers', 'phone')) {
|
||||
$table->string('phone')->nullable()->after('email');
|
||||
}
|
||||
if (!Schema::hasColumn('suppliers', 'address')) {
|
||||
$table->string('address')->nullable()->after('phone');
|
||||
}
|
||||
if (!Schema::hasColumn('suppliers', 'notes')) {
|
||||
$table->text('notes')->nullable()->after('address');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('suppliers', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('suppliers', 'notes')) {
|
||||
$table->dropColumn('notes');
|
||||
}
|
||||
if (Schema::hasColumn('suppliers', 'address')) {
|
||||
$table->dropColumn('address');
|
||||
}
|
||||
if (Schema::hasColumn('suppliers', 'phone')) {
|
||||
$table->dropColumn('phone');
|
||||
}
|
||||
if (Schema::hasColumn('suppliers', 'email')) {
|
||||
$table->dropColumn('email');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user