I have some problem with the Laravel 9 migrations. After i run the "php artisan migrate" command every table created with the indexes. So everthings just fine except the foregin key. I don't have any idea why, maybe someone know what causes the problem or have a solotion. Thank you all!
10.4.22-MariaDB
InnoDB
Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.2
phpMyAdmin: 5.11.1
My migrations:
Schema::create('supplier_orders', function (Blueprint $table) {
$table->increments('Id');
$table->unsignedBigInteger('Warehouse', false)->nullable(false);
$table->unsignedBigInteger('Supplier', false)->nullable(false);
$table->dateTime('StartedAt')->nullable(false)->useCurrent();
$table->dateTime('CompletedAt')->default(null);
$table->string('PrimeVoucherNumber', 100)->nullable(false);
$table->index(['CompletedAt', 'Warehouse', 'Supplier'], 'CompletedWarehouseSupplier');
});
Schema::create('supplier_order_details', function (Blueprint $table) {
$table->increments('Id');
$table->unsignedInteger('SupplierOrder', false)->nullable(false);
$table->unsignedBigInteger('Employee', false)->nullable(false);
$table->unsignedBigInteger('Product', false)->nullable(false);
$table->unsignedDecimal('Quantity', 18, 4)->nullable(false);
$table->index(['SupplierOrder', 'Employee', 'Product'], 'OrderEmployeeProduct')->unique();
$table->index(['Product', 'SupplierOrder', 'Quantity'], 'ProductOrder');
});
Schema::table('supplier_order_details', function (Blueprint $table) {
$table->foreign('SupplierOrder', 'FK_SupplierOrderDetail_SupplierOrder')->references('Id')->on('supplier_orders')->onDelete('CASCADE')->onUpdate('NO ACTION');
});
I found it, there is no error in the migartions, just me.
I am just a big donkey.
I found it in the phpmyadmin under "Table->Structure->Realation view"
I thought that i will found it under "Table->Structure->Table structure->Indexes"
Its make no sense to me why is it there, but finally i found it.
Thanks everyone.