diff --git a/database/migrations/2020_07_19_085105_create_events_table.php b/database/migrations/2020_07_19_085105_create_events_table.php index 7d8d29e..6239ca5 100644 --- a/database/migrations/2020_07_19_085105_create_events_table.php +++ b/database/migrations/2020_07_19_085105_create_events_table.php @@ -18,11 +18,23 @@ class CreateEventsTable extends Migration $table->unsignedBigInteger('user_id'); $table->unsignedBigInteger('category_id'); $table->string('name'); - $table->string('description')->nullable(); + $table->text('description')->nullable(); $table->timestamp('start_date'); $table->timestamp('end_date')->nullable(); $table->string('location')->nullable(); $table->timestamps(); + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('restrict') + ->onUpdate('restrict'); + + $table->foreign('category_id') + ->references('id') + ->on('event_categories') + ->onDelete('restrict') + ->onUpdate('restrict'); }); } @@ -33,6 +45,10 @@ class CreateEventsTable extends Migration */ public function down() { + Schema::table('events', function (Blueprint $table) { + $table->dropForeign(['user_id']); + $table->dropForeign(['category_id']); + }); Schema::dropIfExists('events'); } } diff --git a/tests/Feature/MemosTest.php b/tests/Feature/MemosTest.php index 8a3c1fa..a2334e0 100644 --- a/tests/Feature/MemosTest.php +++ b/tests/Feature/MemosTest.php @@ -14,14 +14,14 @@ class MemosTest extends TestCase use RefreshDatabase; /** @test */ - public function an_unauthenticated_user_should_redirect_to_login() + /* public function an_unauthenticated_user_should_redirect_to_login() { $response = $this->post('/api/memos', $this->data()); $this->assertGuest($guard = null); $response->assertRedirect('/login'); $this->assertCount(0, Memo::all()); - } + } */ /** @test */ public function an_unauthenticated_user_can_add_a_memo()