migrate to gtea from bistbucket
This commit is contained in:
33
database/migrations/2014_10_10_000001_create_plans_table.php
Normal file
33
database/migrations/2014_10_10_000001_create_plans_table.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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::create('plans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('subscriptionName');
|
||||
$table->integer('duration')->default(0); // Duration in days
|
||||
$table->double('offerPrice', 10, 2)->nullable();
|
||||
$table->double('subscriptionPrice', 10, 2)->default(0);
|
||||
$table->boolean('status')->default(1);
|
||||
$table->longText('features')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('plans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('business_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('business_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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::create('businesses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('plan_subscribe_id')->nullable();
|
||||
$table->foreignId('business_category_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('companyName');
|
||||
$table->date('will_expire')->nullable();
|
||||
$table->string('address')->nullable();
|
||||
$table->string('phoneNumber')->nullable();
|
||||
$table->string('pictureUrl')->nullable();
|
||||
$table->timestamp('subscriptionDate')->nullable();
|
||||
$table->double('remainingShopBalance', 10, 2)->default(0);
|
||||
$table->double('shopOpeningBalance', 10, 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('businesses');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('currencies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->string('country_name')->nullable();
|
||||
$table->string('code')->unique();
|
||||
$table->double('rate', 10, 2)->nullable();
|
||||
$table->string('symbol')->nullable();
|
||||
$table->string('position')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->boolean('is_default')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('currencies');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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::create('gateways', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->foreignId('currency_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('mode'); // 1 = Sandbox || 0 = Live
|
||||
$table->string('status');
|
||||
$table->boolean('charge')->default(0);
|
||||
$table->string('image')->nullable();
|
||||
$table->text('data')->nullable();
|
||||
$table->text('manual_data')->nullable();
|
||||
$table->boolean('is_manual')->default(0);
|
||||
$table->boolean('accept_img')->default(0);
|
||||
$table->string('namespace')->nullable();
|
||||
$table->integer('phone_required')->default(0);
|
||||
$table->text('instructions')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('gateways');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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::create('plan_subscribes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('plan_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('gateway_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->double('price', 10, 2)->default(0);
|
||||
$table->string('payment_status')->default('unpaid');
|
||||
$table->integer('duration')->default(0);
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('plan_subscribes');
|
||||
}
|
||||
};
|
||||
38
database/migrations/2014_10_12_000003_create_users_table.php
Normal file
38
database/migrations/2014_10_12_000003_create_users_table.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->nullable()->constrained('businesses')->cascadeOnDelete();
|
||||
$table->string('email')->nullable()->unique();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('role')->default('shop-owner'); // admin || shop-owner || staff
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->string('lang')->nullable();
|
||||
$table->longText('visibility')->nullable();
|
||||
$table->string('password')->nullable();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('options', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key');
|
||||
$table->longText('value');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('options');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('brands', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('brandName');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('brands');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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::create('categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('categoryName');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->boolean('variationCapacity')->default(0);
|
||||
$table->boolean('variationColor')->default(0);
|
||||
$table->boolean('variationSize')->default(0);
|
||||
$table->boolean('variationType')->default(0);
|
||||
$table->boolean('variationWeight')->default(0);
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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::create('parties', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('type')->default('Retailer'); // Retailer || Dealer || Wholesaler || Supplier
|
||||
$table->string('phone')->unique()->nullable();
|
||||
$table->double('due', 10, 2)->default(0);
|
||||
$table->string('address')->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('parties');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('expense_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('categoryName');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->text('categoryDescription')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('expense_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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::create('expenses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->double('amount', 10, 2);
|
||||
$table->foreignId('expense_category_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('expanseFor')->nullable();
|
||||
$table->string('paymentType')->default('Cash');
|
||||
$table->string('referenceNo')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->timestamp('expenseDate')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('expenses');
|
||||
}
|
||||
};
|
||||
30
database/migrations/2023_12_24_170916_create_units_table.php
Normal file
30
database/migrations/2023_12_24_170916_create_units_table.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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::create('units', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('unitName');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('units');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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::create('products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('productName');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('unit_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('brand_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('productCode')->unique();
|
||||
$table->string('productPicture')->nullable();
|
||||
$table->double('productDealerPrice', 10, 2)->default(0);
|
||||
$table->double('productPurchasePrice', 10, 2)->default(0);
|
||||
$table->double('productSalePrice', 10, 2)->default(0);
|
||||
$table->double('productWholeSalePrice', 10, 2)->default(0);
|
||||
$table->integer('productStock')->default(0);
|
||||
$table->string('size')->nullable();
|
||||
$table->string('type')->nullable();
|
||||
$table->string('color')->nullable();
|
||||
$table->string('weight')->nullable();
|
||||
$table->string('capacity')->nullable();
|
||||
$table->string('productManufacturer')->nullable();
|
||||
$table->text('meta')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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::create('purchases', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('party_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->double("discountAmount", 10, 2)->default(0);
|
||||
$table->double("dueAmount", 10, 2)->default(0);
|
||||
$table->double("paidAmount", 10, 2)->default(0);
|
||||
$table->double("totalAmount", 10, 2)->default(0);
|
||||
$table->string("invoiceNumber")->nullable();
|
||||
$table->boolean("isPaid")->default(0);
|
||||
$table->string("paymentType")->default("Cash");
|
||||
$table->timestamp("purchaseDate")->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('purchases');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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::create('purchase_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('purchase_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
|
||||
$table->double('productDealerPrice', 10, 2)->default(0);
|
||||
$table->double('productPurchasePrice', 10, 2)->default(0);
|
||||
$table->double('productSalePrice', 10, 2)->default(0);
|
||||
$table->double('productWholeSalePrice', 10, 2)->default(0);
|
||||
$table->integer('quantities')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('purchase_details');
|
||||
}
|
||||
};
|
||||
42
database/migrations/2023_12_26_170106_create_sales_table.php
Normal file
42
database/migrations/2023_12_26_170106_create_sales_table.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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::create('sales', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('party_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->double('discountAmount', 10, 2)->default(0);
|
||||
$table->double('dueAmount', 10, 2)->default(0);
|
||||
$table->boolean('isPaid')->default(0);
|
||||
$table->double('vat_amount', 10, 2)->default(0);
|
||||
$table->double('vat_percent', 10, 2)->default(0);
|
||||
$table->double('paidAmount', 10, 2)->default(0);
|
||||
$table->double('totalAmount', 10, 2)->default(0);
|
||||
$table->double('lossProfit', 10, 2)->default(0);
|
||||
$table->string('paymentType')->nullable();
|
||||
$table->string('invoiceNumber')->nullable();
|
||||
$table->timestamp('saleDate')->nullable();
|
||||
$table->text('meta')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sales');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('sale_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('sale_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
|
||||
$table->double('price', 10, 2)->default(0);
|
||||
$table->double('lossProfit', 10, 2)->default(0);
|
||||
$table->integer('quantities')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sale_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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::create('banners', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('imageUrl');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('banners');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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::create('due_collects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('party_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sale_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('purchase_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->string('invoiceNumber')->nullable();
|
||||
$table->double('totalDue', 10, 2)->default(0);
|
||||
$table->double('dueAmountAfterPay', 10, 2)->default(0);
|
||||
$table->double('payDueAmount', 10, 2)->default(0);
|
||||
$table->string('paymentType')->default('Cash');
|
||||
$table->timestamp('paymentDate')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('due_collects');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('features', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('bg_color')->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('features');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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::create('pos_app_interfaces', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('image');
|
||||
$table->boolean('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pos_app_interfaces');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('languages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('icon')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('languages');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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::create('testimonials', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('text')->nullable();
|
||||
$table->integer('star');
|
||||
$table->string('client_name');
|
||||
$table->string('client_image')->nullable();
|
||||
$table->string('work_at');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('testimonials');
|
||||
}
|
||||
};
|
||||
35
database/migrations/2024_04_16_094724_create_blogs_table.php
Normal file
35
database/migrations/2024_04_16_094724_create_blogs_table.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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::create('blogs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete(); // Creator Id
|
||||
$table->string('title')->unique();
|
||||
$table->string('slug')->unique();
|
||||
$table->string('image');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->longText('descriptions')->nullable();
|
||||
$table->text('tags')->nullable();
|
||||
$table->longText('meta')->nullable(); // Meta Title, Meta Description
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('blogs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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::create('comments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('blog_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('comment_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
$table->string('comment');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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::create('messages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('phone');
|
||||
$table->string('email');
|
||||
$table->string('company_name')->nullable();
|
||||
$table->string('message');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('messages');
|
||||
}
|
||||
};
|
||||
32
database/migrations/2024_08_06_174713_create_jobs_table.php
Normal file
32
database/migrations/2024_08_06_174713_create_jobs_table.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('income_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('categoryName');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->text('categoryDescription')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('income_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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::create('incomes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->double('amount', 10, 2);
|
||||
$table->foreignId('income_category_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('incomeFor')->nullable();
|
||||
$table->string('paymentType')->default('Cash');
|
||||
$table->string('referenceNo')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->timestamp('incomeDate')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('incomes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('products', function (Blueprint $table) {
|
||||
$table->dropUnique(['productCode']);
|
||||
$table->string('productCode')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->string('productCode')->nullable(false)->unique()->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->string('status')->nullable()->after('password');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('status');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('sale_returns', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sale_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('invoice_no')->nullable();
|
||||
$table->timestamp('return_date')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sale_returns');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('sale_return_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sale_return_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sale_detail_id')->constrained('sale_details')->cascadeOnDelete();
|
||||
$table->double('return_amount', 10, 2)->default(0);
|
||||
$table->integer('return_qty');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sale_return_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('purchase_returns', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('purchase_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('invoice_no')->nullable();
|
||||
$table->timestamp('return_date')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('purchase_returns');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('purchase_return_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('purchase_return_id')->constrained('purchase_returns')->cascadeOnDelete();
|
||||
$table->foreignId('purchase_detail_id')->constrained('purchase_details')->cascadeOnDelete();
|
||||
$table->double('return_amount', 10, 2)->default(0);
|
||||
$table->integer('return_qty');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('purchase_return_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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::create('user_currencies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('currency_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('country_name')->nullable();
|
||||
$table->string('code');
|
||||
$table->double('rate')->nullable();
|
||||
$table->string('symbol')->nullable();
|
||||
$table->string('position')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_currencies');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('categories', function (Blueprint $table) {
|
||||
$table->string('icon')->nullable()->after('business_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
$table->dropColumn('icon');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('brands', function (Blueprint $table) {
|
||||
$table->string('icon')->nullable()->after('brandName');
|
||||
$table->string('description')->nullable()->after('brandName');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('brands', function (Blueprint $table) {
|
||||
$table->dropColumn('icon');
|
||||
$table->dropColumn('description');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->double('productStock', 10, 2)->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('sale_details', function (Blueprint $table) {
|
||||
$table->double('quantities', 10, 2)->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('purchase_details', function (Blueprint $table) {
|
||||
$table->double('quantities', 10, 2)->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('purchase_return_details', function (Blueprint $table) {
|
||||
$table->double('return_qty', 10, 2)->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('sale_return_details', function (Blueprint $table) {
|
||||
$table->double('return_qty', 10, 2)->default(0)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->integer('productStock')->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('purchase_details', function (Blueprint $table) {
|
||||
$table->integer('quantities')->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('purchase_return_details', function (Blueprint $table) {
|
||||
$table->integer('return_qty')->default(0)->change();
|
||||
});
|
||||
|
||||
Schema::table('sale_return_details', function (Blueprint $table) {
|
||||
$table->integer('return_qty')->default(0)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
32
database/migrations/2025_01_16_153449_create_vats_table.php
Normal file
32
database/migrations/2025_01_16_153449_create_vats_table.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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::create('vats', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->double('rate')->default(0);
|
||||
$table->longText('sub_vat')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vats');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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('sales', function (Blueprint $table) {
|
||||
$table->foreignId('vat_id')->nullable()->constrained()->nullOnDelete()->after('vat_percent');
|
||||
});
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->foreignId('vat_id')->nullable()->constrained()->cascadeOnDelete()->after('productStock');
|
||||
$table->string('vat_type')->default('exclusive')->after('productStock');
|
||||
$table->double('vat_amount', 10, 2)->default(0)->after('productStock');
|
||||
$table->double('profit_percent')->default(0)->after('productStock');
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->foreignId('vat_id')->nullable()->constrained()->nullOnDelete()->after('isPaid');
|
||||
$table->double('vat_amount', 10, 2)->default(0)->after('isPaid');
|
||||
$table->double('vat_percent', 10, 2)->default(0)->after('isPaid');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropColumn('vat_id');
|
||||
});
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('vat_id');
|
||||
$table->dropColumn('vat_type');
|
||||
$table->dropColumn('vat_amount');
|
||||
$table->dropColumn('profit_percent');
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->dropColumn('vat_id');
|
||||
$table->dropColumn('vat_amount');
|
||||
$table->dropColumn('vat_percent');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('businesses', function (Blueprint $table) {
|
||||
$table->string('vat_name')->nullable()->after('shopOpeningBalance');
|
||||
$table->string('vat_no')->nullable()->after('shopOpeningBalance');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('businesses', function (Blueprint $table) {
|
||||
$table->dropColumn(['vat_name', 'vat_no']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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('products', function (Blueprint $table) {
|
||||
$table->double('alert_qty')->default(0)->after('productStock');
|
||||
$table->date('expire_date')->nullable()->after('productStock');
|
||||
});
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->string('discount_type')->default('flat')->after('discountAmount'); // flat, percent
|
||||
$table->double('discount_percent')->default(0)->after('discountAmount');
|
||||
$table->double('shipping_charge')->default(0)->after('discountAmount');
|
||||
$table->string('image')->nullable()->after('saleDate');
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->string('discount_type')->default('flat')->after('discountAmount'); // flat, percent
|
||||
$table->double('discount_percent')->default(0)->after('discountAmount');
|
||||
$table->double('shipping_charge')->default(0)->after('discountAmount');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn(['alert_qty', 'expire_date']);
|
||||
});
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropColumn(['discount_type', 'discount_percent', 'shipping_charge', 'image']);
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->dropColumn(['discount_type', 'discount_percent', 'shipping_charge']);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('payment_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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('sales', function (Blueprint $table) {
|
||||
$table->foreignId('payment_type_id')->nullable()->after('paymentType');
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->foreignId('payment_type_id')->nullable()->after('paymentType');
|
||||
$table->string("paymentType")->nullable()->change();
|
||||
});
|
||||
Schema::table('due_collects', function (Blueprint $table) {
|
||||
$table->foreignId('payment_type_id')->nullable()->after('paymentType');
|
||||
$table->string("paymentType")->nullable()->change();
|
||||
});
|
||||
Schema::table('incomes', function (Blueprint $table) {
|
||||
$table->foreignId('payment_type_id')->nullable()->after('paymentType');
|
||||
$table->string("paymentType")->nullable()->change();
|
||||
});
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->foreignId('payment_type_id')->nullable()->after('paymentType');
|
||||
$table->string("paymentType")->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_type_id');
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_type_id');
|
||||
$table->string("paymentType")->default("Cash")->change();
|
||||
});
|
||||
Schema::table('due_collects', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_type_id');
|
||||
$table->string("paymentType")->default("Cash")->change();
|
||||
});
|
||||
Schema::table('incomes', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_type_id');
|
||||
$table->string("paymentType")->default("Cash")->change();
|
||||
});
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropColumn('payment_type_id');
|
||||
$table->string("paymentType")->default("Cash")->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('parties', function (Blueprint $table) {
|
||||
$table->dropUnique('parties_phone_unique');
|
||||
$table->string('phone')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('parties', function (Blueprint $table) {
|
||||
$table->string('phone')->unique()->nullable()->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('sales', function (Blueprint $table) {
|
||||
$table->string('rounding_option')->nullable()->after('totalAmount');
|
||||
$table->double('rounding_amount', 10, 2)->default(0)->after('totalAmount');
|
||||
$table->double('actual_total_amount', 10, 2)->default(0)->after('totalAmount');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropColumn(['rounding_option', 'rounding_amount', 'actual_total_amount']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('sales', function (Blueprint $table) {
|
||||
$table->double('change_amount')->default(0)->after('paidAmount');
|
||||
});
|
||||
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->double('change_amount')->default(0)->after('paidAmount');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropColumn('change_amount');
|
||||
});
|
||||
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->dropColumn('change_amount');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->string('provider')->nullable()->after('visibility');
|
||||
$table->string('provider_id')->nullable()->after('visibility');
|
||||
$table->boolean('is_verified')->default(0)->after('visibility');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('provider');
|
||||
$table->dropColumn('provider_id');
|
||||
$table->dropColumn('is_verified');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('purchase_details', function (Blueprint $table) {
|
||||
$table->date('expire_date')->nullable()->after('quantities');
|
||||
});
|
||||
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->string('type')->nullable()->after('user_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('purchase_details', function (Blueprint $table) {
|
||||
$table->dropColumn('expire_date');
|
||||
});
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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::create('product_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->longText('modules');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_settings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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::create('warehouses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('email')->nullable()->unique();
|
||||
$table->string('address')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('warehouses');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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::create('transfers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('from_warehouse_id')->nullable()->constrained('warehouses')->nullOnDelete();
|
||||
$table->foreignId('to_warehouse_id')->nullable()->constrained('warehouses')->nullOnDelete();
|
||||
$table->date('transfer_date');
|
||||
$table->string('invoice_no')->unique();
|
||||
$table->text('note')->nullable();
|
||||
$table->double('shipping_charge', 10, 2)->default(0);
|
||||
$table->double('sub_total', 10, 2)->default(0);
|
||||
$table->double('total_discount', 10, 2)->default(0);
|
||||
$table->double('total_tax', 10, 2)->default(0);
|
||||
$table->double('grand_total', 12, 2)->default(0);
|
||||
$table->enum('status', ['pending', 'completed', 'cancelled'])->default('pending');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('transfers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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::create('transfer_products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('transfer_id')->constrained('transfers')->cascadeOnDelete();
|
||||
$table->foreignId('product_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('warehouse_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->double('unit_price', 10, 2)->default(0);
|
||||
$table->double('discount', 10, 2)->default(0);
|
||||
$table->double('tax', 10, 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('transfer_products');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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::create('variations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->longText('values');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('variations');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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::create('stocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('batch_no')->nullable();
|
||||
$table->double('productStock')->default(0);
|
||||
$table->double('productPurchasePrice')->default(0);
|
||||
$table->double('profit_percent')->default(0);
|
||||
$table->double('productSalePrice')->default(0);
|
||||
$table->double('productWholeSalePrice')->default(0);
|
||||
$table->double('productDealerPrice')->default(0);
|
||||
$table->string('mfg_date')->nullable();
|
||||
$table->string('expire_date')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stocks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('product_models', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_models');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
<?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('products', function (Blueprint $table) {
|
||||
$table->foreignId('model_id')->nullable()->constrained('product_models')->nullOnDelete()->after('category_id');
|
||||
$table->foreignId('warehouse_id')->nullable()->constrained()->nullOnDelete()->after('category_id');
|
||||
$table->string('product_type')->default('single')->nullable()->after('productPicture');
|
||||
$table->dropForeign(['unit_id']);
|
||||
$table->dropForeign(['brand_id']);
|
||||
$table->dropForeign(['category_id']);
|
||||
$table->foreignId('category_id')->nullable()->change();
|
||||
$table->foreign('unit_id')->references('id')->on('units')->nullOnDelete();
|
||||
$table->foreign('brand_id')->references('id')->on('brands')->nullOnDelete();
|
||||
$table->foreign('category_id')->references('id')->on('categories')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('sale_details', function (Blueprint $table) {
|
||||
$table->foreignId('stock_id')->nullable()->constrained()->nullOnDelete()->after('product_id');
|
||||
$table->string('expire_date')->nullable()->after('quantities');
|
||||
$table->string('mfg_date')->nullable()->after('quantities');
|
||||
$table->double('productPurchasePrice')->default(0)->after('quantities');
|
||||
});
|
||||
|
||||
Schema::table('purchase_details', function (Blueprint $table) {
|
||||
$table->foreignId('stock_id')->nullable()->constrained()->nullOnDelete()->after('product_id');
|
||||
$table->string('profit_percent')->nullable()->after('quantities');
|
||||
$table->string('mfg_date')->nullable()->after('quantities');
|
||||
$table->string('expire_date')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn(['model_id', 'warehouse_id', 'product_type']);
|
||||
$table->dropForeign(['category_id']);
|
||||
$table->dropForeign(['unit_id']);
|
||||
$table->dropForeign(['brand_id']);
|
||||
$table->unsignedBigInteger('category_id')->nullable(false)->change();
|
||||
$table->foreign('category_id')->references('id')->on('categories')->cascadeOnDelete();
|
||||
$table->foreign('unit_id')->references('id')->on('units')->cascadeOnDelete();
|
||||
$table->foreign('brand_id')->references('id')->on('brands')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('sale_details', function (Blueprint $table) {
|
||||
$table->dropColumn(['stock_id', 'expire_date', 'productPurchasePrice', 'mfg_date']);
|
||||
});
|
||||
|
||||
Schema::table('purchase_details', function (Blueprint $table) {
|
||||
$table->dropColumn(['stock_id', 'profit_percent', 'mfg_date']);
|
||||
$table->date('expire_date')->nullable()->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('plans', function (Blueprint $table) {
|
||||
$table->longText('visibility')->nullable()->after('status');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->dropColumn('visibility');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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::create('shelves', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('shelves');
|
||||
}
|
||||
};
|
||||
30
database/migrations/2025_08_17_040002_create_racks_table.php
Normal file
30
database/migrations/2025_08_17_040002_create_racks_table.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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::create('racks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->boolean('status')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('racks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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::create('rack_shelf', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('rack_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('shelf_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('rack_shelf');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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::create('branches', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('address')->nullable();
|
||||
$table->longText('description')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->boolean('is_main')->default(0);
|
||||
$table->double('branchOpeningBalance')->default(0);
|
||||
$table->double('branchRemainingBalance')->default(0);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('branches');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,272 @@
|
||||
<?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
|
||||
{
|
||||
// PARTIES TABLE
|
||||
Schema::table('parties', function (Blueprint $table) {
|
||||
$table->double('credit_limit')->default(0)->after('due');
|
||||
$table->double('loyalty_points')->default(0)->after('due');
|
||||
$table->double('wallet')->default(0)->after('due'); // advance amount
|
||||
$table->double('opening_balance')->default(0)->after('due');
|
||||
$table->string('opening_balance_type')->nullable()->after('due'); // advance / due
|
||||
$table->text('billing_address')->nullable()->after('status');
|
||||
$table->text('shipping_address')->nullable()->after('status');
|
||||
$table->text('meta')->nullable()->after('status');
|
||||
});
|
||||
|
||||
// USERS TABLE
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->cascadeOnDelete();
|
||||
$table->foreignId('active_branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// STOCKS TABLE
|
||||
Schema::table('stocks', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
$table->foreignId('warehouse_id')->nullable()->after('branch_id')->constrained('warehouses')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('product_settings', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('sale_returns', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('purchase_returns', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// EXPENSES
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->unsignedBigInteger('user_id')->nullable()->change();
|
||||
});
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// INCOMES
|
||||
Schema::table('incomes', function (Blueprint $table) {
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->unsignedBigInteger('user_id')->nullable()->change();
|
||||
});
|
||||
Schema::table('incomes', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// SALES
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropForeign(['party_id']);
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->unsignedBigInteger('party_id')->nullable()->change();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->change();
|
||||
});
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->foreign('party_id')->references('id')->on('parties')->nullOnDelete();
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// PURCHASES
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->dropForeign(['party_id']);
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->unsignedBigInteger('party_id')->nullable()->change();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->change();
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->foreign('party_id')->references('id')->on('parties')->nullOnDelete();
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// DUE COLLECTS
|
||||
Schema::table('due_collects', function (Blueprint $table) {
|
||||
$table->dropForeign(['party_id']);
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->dropForeign(['sale_id']);
|
||||
$table->dropForeign(['purchase_id']);
|
||||
|
||||
$table->unsignedBigInteger('party_id')->nullable()->change();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->change();
|
||||
$table->unsignedBigInteger('sale_id')->nullable()->change();
|
||||
$table->unsignedBigInteger('purchase_id')->nullable()->change();
|
||||
});
|
||||
Schema::table('due_collects', function (Blueprint $table) {
|
||||
$table->foreign('party_id')->references('id')->on('parties')->nullOnDelete();
|
||||
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
|
||||
$table->foreign('sale_id')->references('id')->on('sales')->nullOnDelete();
|
||||
$table->foreign('purchase_id')->references('id')->on('purchases')->nullOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
// Plan
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->boolean('allow_multibranch')->default(0)->after('status');
|
||||
$table->integer('addon_domain_limit')->nullable()->after('allow_multibranch');
|
||||
$table->integer('subdomain_limit')->nullable()->after('addon_domain_limit');
|
||||
});
|
||||
|
||||
// PLAN SUBSCRIBED
|
||||
Schema::table('plan_subscribes', function (Blueprint $table) {
|
||||
$table->boolean('allow_multibranch')->default(0)->after('price');
|
||||
$table->integer('addon_domain_limit')->default(0)->after('price');
|
||||
$table->integer('subdomain_limit')->default(0)->after('price');
|
||||
});
|
||||
|
||||
// BUSINESS TABLE
|
||||
Schema::table('businesses', function (Blueprint $table) {
|
||||
$table->string('email')->nullable()->after('address');
|
||||
$table->boolean('status')->default(1)->after('vat_name');
|
||||
});
|
||||
|
||||
// TRANSFERS
|
||||
Schema::table('transfers', function (Blueprint $table) {
|
||||
$table->foreignId('from_branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
$table->foreignId('to_branch_id')->nullable()->after('from_warehouse_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('transfer_products', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('warehouse_id');
|
||||
$table->foreignId('stock_id')->nullable()->after('transfer_id')->constrained('stocks')->nullOnDelete();
|
||||
});
|
||||
|
||||
// Products
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->foreignId('rack_id')->nullable()->after('business_id')->constrained('racks')->nullOnDelete();
|
||||
$table->foreignId('shelf_id')->nullable()->after('rack_id')->constrained('shelves')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// PARTIES
|
||||
Schema::table('parties', function (Blueprint $table) {
|
||||
$table->dropColumn(['credit_limit', 'loyalty_points', 'wallet', 'opening_balance', 'opening_balance_type', 'billing_address', 'shipping_address', 'meta']);
|
||||
});
|
||||
|
||||
// USERS
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['branch_id', 'active_branch_id']);
|
||||
});
|
||||
|
||||
// STOCKS
|
||||
Schema::table('stocks', function (Blueprint $table) {
|
||||
$table->dropColumn(['branch_id', 'warehouse_id']);
|
||||
});
|
||||
|
||||
Schema::table('product_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('branch_id');
|
||||
});
|
||||
|
||||
Schema::table('sale_returns', function (Blueprint $table) {
|
||||
$table->dropColumn('branch_id');
|
||||
});
|
||||
|
||||
Schema::table('purchase_returns', function (Blueprint $table) {
|
||||
$table->dropColumn('branch_id');
|
||||
});
|
||||
|
||||
// EXPENSES
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->dropColumn('branch_id');
|
||||
$table->unsignedBigInteger('user_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
// INCOMES
|
||||
Schema::table('incomes', function (Blueprint $table) {
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->dropColumn('branch_id');
|
||||
$table->unsignedBigInteger('user_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('incomes', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
// SALES
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->dropForeign(['party_id', 'user_id']);
|
||||
$table->dropColumn('branch_id');
|
||||
$table->unsignedBigInteger('party_id')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('user_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('sales', function (Blueprint $table) {
|
||||
$table->foreign('party_id')->references('id')->on('parties')->cascadeOnDelete();
|
||||
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
// PURCHASES
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->dropForeign(['party_id', 'user_id']);
|
||||
$table->dropColumn('branch_id');
|
||||
$table->unsignedBigInteger('party_id')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('user_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$table->foreign('party_id')->references('id')->on('parties')->cascadeOnDelete();
|
||||
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
// DUE COLLECTS
|
||||
Schema::table('due_collects', function (Blueprint $table) {
|
||||
$table->dropForeign(['party_id', 'user_id', 'sale_id', 'purchase_id']);
|
||||
$table->dropColumn('branch_id');
|
||||
$table->unsignedBigInteger('party_id')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('user_id')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('sale_id')->nullable(false)->change();
|
||||
$table->unsignedBigInteger('purchase_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('due_collects', function (Blueprint $table) {
|
||||
$table->foreign('party_id')->references('id')->on('parties')->cascadeOnDelete();
|
||||
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
$table->foreign('sale_id')->references('id')->on('sales')->cascadeOnDelete();
|
||||
$table->foreign('purchase_id')->references('id')->on('purchases')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
// Plans
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->dropColumn(['allow_multibranch', 'addon_domain_limit', 'subdomain_limit']);
|
||||
});
|
||||
|
||||
// Plans
|
||||
Schema::table('plan_subscribes', function (Blueprint $table) {
|
||||
$table->dropColumn(['allow_multibranch', 'addon_domain_limit', 'subdomain_limit']);
|
||||
});
|
||||
|
||||
// BUSINESS TABLE
|
||||
Schema::table('businesses', function (Blueprint $table) {
|
||||
$table->dropColumn(['email', 'status']);
|
||||
});
|
||||
|
||||
// TRANSFERS
|
||||
Schema::table('transfers', function (Blueprint $table) {
|
||||
$table->dropColumn(['from_branch_id', 'to_branch_id']);
|
||||
});
|
||||
|
||||
Schema::table('transfer_products', function (Blueprint $table) {
|
||||
$table->foreignId('warehouse_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->dropColumn('stock_id');
|
||||
});
|
||||
|
||||
// Products
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn(['rack_id', 'shelf_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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::create('transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('platform'); // sale, purchase, income, expense, due_pay / due_collect, bank, cash, cheque, sale_return, purchase_return, payroll
|
||||
$table->string('transaction_type'); // cash_payment, cheque_payment, wallet_payment, bank_payment, bank_to_bank, bank_to_cash, cash_to_bank, adjust_bank, adjust_cash, cheque_to_bank, cheque_to_cash
|
||||
$table->string('type')->nullable(); // debit, credit, transfer, pending, deposit, others
|
||||
$table->double('amount', 15, 3);
|
||||
$table->date('date')->nullable();
|
||||
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('payment_type_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('from_bank')->nullable()->constrained('payment_types')->nullOnDelete();
|
||||
$table->foreignId('to_bank')->nullable()->constrained('payment_types')->nullOnDelete();
|
||||
$table->unsignedBigInteger('reference_id')->nullable(); // sale_id, purchase_id, due_collect_id, income_id, expense_id, payroll_id
|
||||
$table->string('invoice_no')->nullable(); // related invoice no
|
||||
$table->string('image')->nullable();
|
||||
$table->text('note')->nullable(); // description/note
|
||||
$table->longText('meta')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('transactions');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?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('payment_types', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained()->nullOnDelete();
|
||||
$table->decimal('balance', 15, 3)->default(0)->after('name');
|
||||
$table->decimal('opening_balance', 15, 3)->default(0)->after('name');
|
||||
$table->date('opening_date')->nullable()->after('name');
|
||||
$table->boolean('show_in_invoice')->default(1)->after('name');
|
||||
$table->longText('meta')->nullable()->after('name');
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::table('stocks', function (Blueprint $table) {
|
||||
$table->string('variant_name')->nullable()->after('productDealerPrice');
|
||||
$table->longText('variation_data')->nullable()->after('productDealerPrice');
|
||||
$table->longText('serial_numbers')->nullable()->after('productDealerPrice');
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->text('variation_ids')->nullable()->after('productCode');
|
||||
$table->integer('has_serial')->default(0)->after('productCode');
|
||||
$table->longText('warranty_guarantee_info')->nullable()->after('productCode');
|
||||
});
|
||||
|
||||
Schema::table('sale_details', function (Blueprint $table) {
|
||||
$table->longText('warranty_guarantee_info')->nullable()->after('quantities');
|
||||
$table->double('discount')->default(0)->after('price');
|
||||
});
|
||||
|
||||
Schema::table('gateways', function (Blueprint $table) {
|
||||
$table->longText('platform')->nullable()->after('name');
|
||||
});
|
||||
|
||||
Schema::table('businesses', function (Blueprint $table) {
|
||||
$table->longText('meta')->nullable()->after('vat_name');
|
||||
});
|
||||
|
||||
Schema::table('parties', function (Blueprint $table) {
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained()->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('payment_types', function (Blueprint $table) {
|
||||
$table->dropColumn(['branch_id', 'opening_balance', 'opening_date', 'show_in_invoice', 'meta', 'balance','deleted_at']);
|
||||
});
|
||||
|
||||
Schema::table('stocks', function (Blueprint $table) {
|
||||
$table->dropColumn(['variant_name', 'variation_data', 'serial_numbers']);
|
||||
$table->dropSoftDeletes();
|
||||
});
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn(['variation_ids', 'warranty_guarantee_info','has_serial']);
|
||||
});
|
||||
|
||||
Schema::table('sale_details', function (Blueprint $table) {
|
||||
$table->dropColumn(['warranty_guarantee_info', 'discount']);
|
||||
});
|
||||
|
||||
Schema::table('gateways', function (Blueprint $table) {
|
||||
$table->dropColumn('platform');
|
||||
});
|
||||
|
||||
Schema::table('businesses', function (Blueprint $table) {
|
||||
$table->dropColumn('meta');
|
||||
});
|
||||
|
||||
Schema::table('parties', function (Blueprint $table) {
|
||||
$table->dropColumn('branch_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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::create('combo_products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('branch_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('stock_id')->constrained()->cascadeOnDelete();
|
||||
$table->double('purchase_price', 15, 3)->default(0);
|
||||
$table->double('quantity', 15, 3)->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('combo_products');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('products', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('products', 'is_displayed_in_pos')) {
|
||||
$table->boolean('is_displayed_in_pos')->default(true)->after('product_type');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('products', 'is_displayed_in_pos')) {
|
||||
$table->dropColumn('is_displayed_in_pos');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user