Нет описания

2014_10_07_042129_create_administrators_table.php 754B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use Illuminate\Database\Schema\Blueprint;
  3. use Illuminate\Database\Migrations\Migration;
  4. class CreateAdministratorsTable extends Migration {
  5. /**
  6. * Run the migrations.
  7. *
  8. * @return void
  9. */
  10. public function up()
  11. {
  12. Schema::create('administrators', function(Blueprint $table)
  13. {
  14. $table->engine = 'InnoDB';
  15. $table->increments('id');
  16. $table->integer('user_id')->unsigned();
  17. $table->timestamps();
  18. });
  19. Schema::table('administrators', function(Blueprint $table)
  20. {
  21. $table->foreign('user_id')
  22. ->references('id')
  23. ->on('users')
  24. ->onDelete('cascade')
  25. ->onUpdate('cascade');
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. *
  31. * @return void
  32. */
  33. public function down()
  34. {
  35. Schema::drop('administrators');
  36. }
  37. }