Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipfilipovich/14f4cf99b074fa4c93a4edf60183d3bc to your computer and use it in GitHub Desktop.
Save filipfilipovich/14f4cf99b074fa4c93a4edf60183d3bc to your computer and use it in GitHub Desktop.
Books table migration class
<?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('books', static function (Blueprint $table) {
$table->id();
$table->string('title', 512);
$table->string('author', 128);
$table->string('isbn', 13);
$table->date('date_published');
$table->integer('number_sold');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('books');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment