33 lines
981 B
PHP
33 lines
981 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('bukus', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('kategori_id')->constrained('kategoris')->onDelete('cascade');
|
|
$table->string('judul');
|
|
$table->string('pengarang');
|
|
$table->string('penerbit');
|
|
$table->year('tahun_terbit');
|
|
$table->string('isbn', 20)->unique();
|
|
$table->integer('stok')->default(0);
|
|
$table->integer('stok_tersedia')->default(0);
|
|
$table->text('sinopsis')->nullable();
|
|
$table->string('cover')->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('bukus');
|
|
}
|
|
};
|