2019_05_24_211222_create_tokens_table.php 967 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 CreateTokensTable extends Migration
  8. {
  9. /**
  10. * Run the migrations.
  11. *
  12. * @return void
  13. */
  14. public function up()
  15. {
  16. Schema::create('tokens', function (Blueprint $table) {
  17. $table->string('key', 60)->primary();
  18. $table->string('secret', 120)->unique();
  19. $table->string('type', 10); // human | system
  20. $table->string('user_uid', 100);
  21. $table->foreign('user_uid')->references('uid')->on('users');
  22. $table->timestampTz('created_at');
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::dropIfExists('tokens');
  33. }
  34. }