2020_07_15_142000_create_calendar_games_table.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateCalendarGamesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('calendar_games', function (Blueprint $table) {
  15. $table->increments('id');
  16. $table->integer('calendar_id')->unsigned()->nullable();
  17. $table->foreign('calendar_id')->references('id')->on('calendars');
  18. $table->integer('home_team_id')->unsigned()->nullable();
  19. $table->foreign('home_team_id')->references('id')->on('teams');
  20. $table->integer('away_team_id')->unsigned()->nullable();
  21. $table->foreign('away_team_id')->references('id')->on('teams');
  22. $table->datetime('date');
  23. $table->integer('day');
  24. $table->string('type');
  25. $table->integer('home_goals')->nullable();
  26. $table->integer('away_goals')->nullable();
  27. $table->integer('home_points')->nullable();
  28. $table->integer('away_points')->nullable();
  29. $table->timestamps();
  30. });
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::dropIfExists('calendar_games');
  40. }
  41. }