HOME


Mini Shell 1.0
DIR: /home/cardxfeb/www/database/migrations/
Upload File :
Current File : //home/cardxfeb/www/database/migrations/2023_01_03_101106_create_affiliate_user_table.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.
     */
    public function up(): void
    {
        Schema::create('affiliate_users', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('affiliated_by');
            $table->unsignedBigInteger('user_id');
            $table->integer('amount');
            $table->timestamps();

            $table->foreign('affiliated_by')->references('id')->on('users');
            $table->foreign('user_id')->references('id')->on('users');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('affiliate_users');
    }
};