Level 75
Not who, but what:
1 like
May Sale! All accounts are 40% off this week.
please who can help me create this as migration file
---- Database: `---- ------------------------------------------------------------ Table structure for table `notifications`--CREATE TABLE `notifications` ( `id` bigint(20) NOT NULL, `sender_id` bigint(20) UNSIGNED NOT NULL, `recipient_id` bigint(20) UNSIGNED NOT NULL, `item_id` bigint(20) UNSIGNED DEFAULT NULL, `notification_type` text COLLATE utf8mb4_unicode_ci NOT NULL, `like_id` bigint(20) UNSIGNED DEFAULT NULL, `comment_id` int(11) DEFAULT NULL, `seen` enum('1','2') COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
should be like this if am not mistaken
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->id();
$table->bigint('sender_id');
$table->bigint('recipient_id');
$table->bigint('item_id')->nullable();
$table->string('notification_type');
$table->bigint('like_id')->nullable();
$table->int('comment_id')->nullable();
$table->int('difficulty', ['1', '2']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
Please or to participate in this conversation.