| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?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('spare_parts', function (Blueprint $table) {
- $table->id();
- // БЕЗ поля year! Каталог общий для всех лет
- $table->string('article')->unique();
- $table->string('used_in_maf')->nullable();
- $table->foreignId('product_id')->nullable()->constrained('products')->nullOnDelete();
- $table->text('note')->nullable();
- // Цены в копейках (как в Product)
- $table->unsignedBigInteger('purchase_price')->nullable();
- $table->unsignedBigInteger('customer_price')->nullable();
- $table->unsignedBigInteger('expertise_price')->nullable();
- $table->string('tsn_number')->nullable();
- $table->text('pricing_code')->nullable();
- $table->integer('min_stock')->default(0);
- $table->softDeletes();
- $table->timestamps();
- // Индексы без year
- $table->index('article');
- $table->index('used_in_maf');
- });
- }
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('spare_parts');
- }
- };
|