diff options
Diffstat (limited to 'laravel/database/migrations')
| -rw-r--r-- | laravel/database/migrations/2019_01_12_153012_create_suggested_table.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/laravel/database/migrations/2019_01_12_153012_create_suggested_table.php b/laravel/database/migrations/2019_01_12_153012_create_suggested_table.php new file mode 100644 index 0000000..1f907ec --- /dev/null +++ b/laravel/database/migrations/2019_01_12_153012_create_suggested_table.php @@ -0,0 +1,37 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateSuggestedTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('suggestions', function (Blueprint $table) { + $table->increments('id'); + $table->unsignedInteger('from'); + $table->unsignedInteger('song'); + $table->unsignedInteger('clicks')->default(0); + $table->unsignedInteger('shown')->default(0); + $table->timestamps(); + $table->foreign('from')->references('id')->on('songs')->onDelete('cascade'); + $table->foreign('song')->references('id')->on('songs'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('suggestions'); + } +} |
