update order and order_item

This commit is contained in:
2025-12-12 13:15:02 +08:00
parent e96e767b92
commit 651de05bb5
4 changed files with 139 additions and 13 deletions
@@ -0,0 +1,31 @@
<?php
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('order_items', function (Blueprint $table) {
$table->foreign('order_id')
->references('id')
->on('orders')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('order_items', function (Blueprint $table) {
$table->dropForeign(['order_id']);
});
}
};