|
5 | 5 |
|
6 | 6 | class CreateLikeableTables extends Migration |
7 | 7 | { |
8 | | - public function up() |
9 | | - { |
10 | | - Schema::create('likeable_likes', function(Blueprint $table) { |
11 | | - $table->bigIncrements('id'); |
12 | | - $table->string('likeable_id', 36); |
13 | | - $table->string('likeable_type', 255); |
14 | | - $table->string('user_id', 36)->index(); |
15 | | - $table->timestamps(); |
16 | | - $table->unique(['likeable_id', 'likeable_type', 'user_id'], 'likeable_likes_unique'); |
17 | | - }); |
18 | | - |
19 | | - Schema::create('likeable_like_counters', function(Blueprint $table) { |
20 | | - $table->bigIncrements('id'); |
21 | | - $table->string('likeable_id', 36); |
22 | | - $table->string('likeable_type', 255); |
23 | | - $table->unsignedBigInteger('count')->default(0); |
24 | | - $table->unique(['likeable_id', 'likeable_type'], 'likeable_counts'); |
25 | | - }); |
26 | | - |
27 | | - } |
| 8 | + public function up() |
| 9 | + { |
| 10 | + Schema::create('likeable_likes', function (Blueprint $table) { |
| 11 | + $table->bigIncrements('id'); |
| 12 | + $table->string('likeable_id', 36); |
| 13 | + $table->string('likeable_type', 255); |
| 14 | + $table->string('user_id', 36)->index(); |
| 15 | + $table->timestamps(); |
| 16 | + $table->unique(['likeable_id', 'likeable_type', 'user_id'], 'likeable_likes_unique'); |
| 17 | + }); |
| 18 | + |
| 19 | + Schema::create('likeable_like_counters', function (Blueprint $table) { |
| 20 | + $table->bigIncrements('id'); |
| 21 | + $table->string('likeable_id', 36); |
| 22 | + $table->string('likeable_type', 255); |
| 23 | + $table->unsignedBigInteger('count')->default(0); |
| 24 | + $table->unique(['likeable_id', 'likeable_type'], 'likeable_counts'); |
| 25 | + }); |
| 26 | + } |
28 | 27 |
|
29 | | - public function down() |
30 | | - { |
31 | | - Schema::drop('likeable_likes'); |
32 | | - Schema::drop('likeable_like_counters'); |
33 | | - } |
| 28 | + public function down() |
| 29 | + { |
| 30 | + Schema::drop('likeable_likes'); |
| 31 | + Schema::drop('likeable_like_counters'); |
| 32 | + } |
34 | 33 | } |
0 commit comments