This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
coupon/database/migrations/2021_09_05_153941_create_coupons_table.php
2021-09-05 17:20:59 +02:00

43 lines
1001 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCouponsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('coupons', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('brand_id');
$table->unsignedBigInteger('coupon_order_id');
$table->unsignedBigInteger('user_id')->nullable();
$table->string('code')->unique();
$table->timestamp('collected_at')->nullable();
$table->foreign('user_id')->references('id')->on('users');
$table->index('id');
$table->index('code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('coupons');
}
}