Skip to content

Commit

Permalink
feat: create migration for invoices table with sch
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Mar 11, 2024
1 parent f692b5a commit 45b6808
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions database/migrations/xxxx_xx_xx_xxxxxx_create_invoices_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateInvoicesTable extends Migration
{
public function up()
{
Schema::create('invoices', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('order_id');
$table->unsignedBigInteger('customer_id');
$table->timestamp('invoice_date');
$table->decimal('total_amount', 10, 2);
$table->string('payment_status');
$table->timestamps();

$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
});
}

public function down()
{
Schema::dropIfExists('invoices');
}
}

0 comments on commit 45b6808

Please sign in to comment.