Files
livewire-budget/database/migrations/2021_05_28_182942_create_posts_table.php
2021-06-06 15:15:08 +02:00

39 lines
837 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->smallInteger("year");
$table->string("name", 128);
$table->boolean("is_expense");
$table->unsignedBigInteger('category_id');
$table->foreign('category_id')->references('id')->on('categories');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('posts');
}
}