blob: 18698924b6883f50045239fa444cf564466abb46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDiscussionTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('discussion', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('article_id')->default(0);
$table->string('title');
$table->string('source');
$table->string('item_id')->unique();
$table->string('source_url');
$table->integer('posted_on');
$table->integer('comments')->default(0);
$table->integer('upvotes')->default(0);
$table->foreign('article_id')->references('id')->on('article')->onDelete('cascade');
$table->unique(['item_id', 'posted_on', 'source']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('discussion');
}
}
|