Skip to content

Commit 0868a14

Browse files
committed
chore: add missing Purchase module migration files
Five Purchase migrations were untracked after Phase 7 commit: po_vendors, po_rfqs, po_rfq_lines, pos, po_lines tables. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1c108cc commit 0868a14

5 files changed

Lines changed: 160 additions & 0 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::dropIfExists('po_vendors');
12+
Schema::create('po_vendors', function (Blueprint $table) {
13+
$table->id();
14+
$table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete();
15+
$table->string('name');
16+
$table->string('email')->nullable();
17+
$table->string('phone')->nullable();
18+
$table->text('address')->nullable();
19+
$table->string('currency')->default('USD');
20+
$table->string('payment_terms')->nullable();
21+
$table->boolean('is_active')->default(true);
22+
$table->unsignedTinyInteger('rating')->nullable();
23+
$table->timestamps();
24+
});
25+
}
26+
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('po_vendors');
30+
}
31+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::dropIfExists('po_rfqs');
12+
Schema::create('po_rfqs', function (Blueprint $table) {
13+
$table->id();
14+
$table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete();
15+
$table->string('rfq_number');
16+
$table->foreignId('po_vendor_id')->constrained('po_vendors')->cascadeOnDelete();
17+
$table->enum('status', ['draft', 'sent', 'received', 'cancelled'])->default('draft');
18+
$table->date('expected_delivery')->nullable();
19+
$table->text('notes')->nullable();
20+
$table->string('currency')->default('USD');
21+
$table->timestamp('sent_at')->nullable();
22+
$table->timestamps();
23+
24+
$table->unique(['tenant_id', 'rfq_number']);
25+
});
26+
}
27+
28+
public function down(): void
29+
{
30+
Schema::dropIfExists('po_rfqs');
31+
}
32+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::dropIfExists('po_rfq_lines');
12+
Schema::create('po_rfq_lines', function (Blueprint $table) {
13+
$table->id();
14+
$table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete();
15+
$table->foreignId('po_rfq_id')->constrained('po_rfqs')->cascadeOnDelete();
16+
$table->string('product_name');
17+
$table->text('description')->nullable();
18+
$table->decimal('quantity', 10, 3)->default(1);
19+
$table->decimal('unit_price', 10, 2)->default(0);
20+
$table->string('uom')->default('unit');
21+
$table->decimal('subtotal', 10, 2)->default(0);
22+
$table->timestamps();
23+
});
24+
}
25+
26+
public function down(): void
27+
{
28+
Schema::dropIfExists('po_rfq_lines');
29+
}
30+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::dropIfExists('pos');
12+
Schema::create('pos', function (Blueprint $table) {
13+
$table->id();
14+
$table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete();
15+
$table->string('po_number');
16+
$table->foreignId('po_rfq_id')->nullable()->constrained('po_rfqs')->nullOnDelete();
17+
$table->foreignId('po_vendor_id')->constrained('po_vendors')->cascadeOnDelete();
18+
$table->enum('status', ['draft', 'confirmed', 'received', 'cancelled'])->default('draft');
19+
$table->date('order_date');
20+
$table->date('expected_delivery')->nullable();
21+
$table->text('notes')->nullable();
22+
$table->string('currency')->default('USD');
23+
$table->decimal('total_amount', 12, 2)->default(0);
24+
$table->timestamp('confirmed_at')->nullable();
25+
$table->timestamp('received_at')->nullable();
26+
$table->timestamps();
27+
28+
$table->unique(['tenant_id', 'po_number']);
29+
});
30+
}
31+
32+
public function down(): void
33+
{
34+
Schema::dropIfExists('pos');
35+
}
36+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::dropIfExists('po_lines');
12+
Schema::create('po_lines', function (Blueprint $table) {
13+
$table->id();
14+
$table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete();
15+
$table->foreignId('po_id')->constrained('pos')->cascadeOnDelete();
16+
$table->string('product_name');
17+
$table->text('description')->nullable();
18+
$table->decimal('quantity', 10, 3)->default(1);
19+
$table->decimal('unit_price', 10, 2)->default(0);
20+
$table->string('uom')->default('unit');
21+
$table->decimal('subtotal', 10, 2)->default(0);
22+
$table->decimal('received_qty', 10, 3)->default(0);
23+
$table->timestamps();
24+
});
25+
}
26+
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('po_lines');
30+
}
31+
};

0 commit comments

Comments
 (0)