2019_12_02_124500_create_tablemodel_test_tables.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // Copyright 2019 Hackware SpA <human@hackware.cl>
  3. // "Hackware Web Services Core" is released under the MIT License terms.
  4. use Illuminate\Support\Facades\Schema;
  5. use Illuminate\Database\Schema\Blueprint;
  6. use Illuminate\Database\Migrations\Migration;
  7. class CreateTablemodelTestTables extends Migration
  8. {
  9. /**
  10. * Run the migrations.
  11. *
  12. * @return void
  13. */
  14. public function up()
  15. {
  16. Schema::create('foreigns', function (Blueprint $table) {
  17. $table->increments('id')->unsigned();
  18. });
  19. Schema::create('dumbs', function (Blueprint $table) {
  20. $table->increments('id')->unsigned();
  21. $table->string('attr1')->nullable();
  22. $table->string('attr2')->nullable();
  23. $table->string('custom_getter')->nullable();
  24. $table->string('custom_setter')->nullable();
  25. $table->timestamp('created_at')->nullable();
  26. $table->timestamp('updated_at')->nullable();
  27. $table->timestamp('deleted_at')->nullable();
  28. $table->timestamp('else_at')->nullable();
  29. $table->integer('foreign_id')->unsigned()->nullable();
  30. $table->foreign('foreign_id')->references('id')->on('foreigns');
  31. $table->integer('other_foreign_id')->unsigned()->nullable();
  32. $table->foreign('other_foreign_id')
  33. ->references('id')
  34. ->on('foreigns');
  35. });
  36. }
  37. public function down()
  38. {
  39. Schema::drop('dumbs');
  40. Schema::drop('foreigns');
  41. }
  42. }