osb/database/migrations/0280-create_payments.php

55 lines
1.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payments', function(Blueprint $table)
{
$table->id();
$table->timestamps();
$table->integer('site_id')->unsigned();
$table->boolean('active')->default(false);
$table->string('checkout_data')->nullable();
$table->float('total_amt', 10, 0);
$table->float('fees_amt', 10, 0)->nullable();
$table->boolean('pending_status')->nullable();
$table->text('notes', 65535)->nullable();
$table->string('ip', 128)->nullable();
$table->string('pending')->nullable();
$table->date('paid_at');
$table->integer('account_id')->unsigned();
$table->foreign(['account_id','site_id'])->references(['id','site_id'])->on('accounts');
$table->integer('checkout_id')->unsigned();
$table->foreign(['checkout_id','site_id'])->references(['id','site_id'])->on('checkouts');
$table->integer('source_id')->nullable();
$table->foreign(['source_id','site_id'])->references(['id','site_id'])->on('users');
$table->unique(['id','site_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('payments');
}
};