]> BookStack Code Mirror - bookstack/blob - database/migrations/2021_05_15_173110_create_favourites_table.php
Lexical: Updated URL handling, added mouse handling
[bookstack] / database / migrations / 2021_05_15_173110_create_favourites_table.php
1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9     /**
10      * Run the migrations.
11      */
12     public function up(): void
13     {
14         Schema::create('favourites', function (Blueprint $table) {
15             $table->increments('id');
16             $table->integer('user_id')->index();
17             $table->integer('favouritable_id');
18             $table->string('favouritable_type', 100);
19             $table->timestamps();
20
21             $table->index(['favouritable_id', 'favouritable_type'], 'favouritable_index');
22         });
23     }
24
25     /**
26      * Reverse the migrations.
27      */
28     public function down(): void
29     {
30         Schema::dropIfExists('favourites');
31     }
32 };