ctrlpanel/database/migrations/2021_07_09_190453_create_vouchers_table.php

37 lines
845 B
PHP
Raw Normal View History

2021-07-09 22:18:22 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVouchersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('vouchers', function (Blueprint $table) {
$table->id();
$table->string('code', 36)->unique();
$table->string('memo')->nullable();
$table->unsignedFloat('credits', 10);
$table->unsignedInteger('uses')->default(1);
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('vouchers');
}
}