![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/inventory.corals.io/Corals/modules/Inventory/database/migrations/ |
<?php namespace Corals\Modules\Inventory\database\migrations; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class InventoryTables extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('inv_inventories', function (Blueprint $table) { $table->increments('id'); $table->string('name')->index(); $table->text('description')->nullable(); $table->unsignedInteger('location_id')->nullable(); $table->foreign('location_id')->references('id')->on('utility_locations'); $table->string('status'); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('inv_suppliers', function (Blueprint $table) { $table->increments('id'); $table->string('name')->index(); $table->string('email')->nullable(); $table->string('status'); $table->string('address')->nullable(); $table->integer('phone')->nullable(); $table->text('notes')->nullable(); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('inv_items', function (Blueprint $table) { $table->increments('id'); $table->string('code')->index(); $table->string('name'); $table->unsignedInteger('category_id')->nullable(); $table->foreign('category_id')->references('id')->on('utility_categories'); $table->decimal('price'); $table->decimal('wholesale_price')->nullable(); $table->string('status'); $table->text('description')->nullable(); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('inv_inventory_has_items', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('inventory_id'); $table->foreign('inventory_id')->references('id')->on('inv_inventories'); $table->unsignedInteger('item_id'); $table->foreign('item_id')->references('id')->on('inv_items'); $table->string('status'); $table->string('inventory_type'); $table->integer('inventory_value')->nullable()->default(0); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('inv_transactions', function (Blueprint $table) { $table->increments('id'); $table->string('code')->index(); $table->unsignedInteger('inventory_id'); $table->foreign('inventory_id')->references('id')->on('inv_inventories'); $table->unsignedInteger('item_id'); $table->foreign('item_id')->references('id')->on('inv_items'); $table->nullableMorphs('sourcable'); $table->string('direction')->index(); $table->integer('quantity'); $table->decimal('item_price'); $table->text('notes')->nullable(); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('inv_orders', function (Blueprint $table) { $table->increments('id'); $table->string('number')->index(); $table->unsignedInteger('inventory_id'); $table->foreign('inventory_id')->references('id')->on('inv_inventories')->cascadeOnUpdate()->cascadeOnDelete(); $table->decimal('sub_total')->default('0'); $table->decimal('discount_total')->default('0'); $table->decimal('tax_total')->default('0'); $table->decimal('adjustment_total')->default('0'); $table->decimal('total')->default('0'); $table->decimal('currency_exchange')->default('0'); $table->unsignedInteger('supplier_id')->nullable(); $table->foreign('supplier_id')->references('id')->on('inv_suppliers'); $table->string('status'); $table->string('currency'); $table->text('billing')->nullable(); $table->unsignedInteger('user_id')->nullable(); $table->foreign('user_id')->references('id') ->on('users')->cascadeOnUpdate()->cascadeOnDelete(); $table->text('notes')->nullable(); $table->text('shipping')->nullable(); $table->string('type')->default('sales_order'); $table->date('order_date')->nullable(); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('inv_order_items', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('order_id'); $table->foreign('order_id')->references('id')->on('inv_orders')->cascadeOnUpdate()->cascadeOnDelete(); $table->string('item_code')->nullable(); $table->text('type')->nullable(); $table->integer('amount')->index(); $table->integer('quantity'); $table->decimal('sub_total')->nullable(); $table->string('tax_ids')->nullable(); $table->text('description')->nullable(); $table->text('properties'); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('inv_order_items'); Schema::dropIfExists('inv_orders'); Schema::dropIfExists('inv_transactions'); Schema::dropIfExists('inv_inventory_has_items'); Schema::dropIfExists('inv_items'); Schema::dropIfExists('inv_suppliers'); Schema::dropIfExists('inv_inventories'); } }