Advertisement
kura2yamato

migration

Nov 11th, 2019
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. <?php
  2. //contact harus duluan dibikin
  3. Schema::create('contacts', function (Blueprint $table) {
  4. $table->increments('id');
  5. $table->char('phone', 16)->unique();//ngak yakin
  6. $table->enum('aktivasi', [0, 1])->default(1);
  7. $table->timestamps();
  8. $table->string('update_by');
  9. $table->softDeletes();
  10. $table->string('delete_by');
  11. });
  12.  
  13. Schema::create('users', function (Blueprint $table) {
  14. $table->increments('id');
  15. $table->char('phone',16);
  16. $table->foreign('phone')->references('phone')->on('contacts')->onUpdate('cascade');
  17. //->onDelete('restrict');
  18. $table->string('name')->index();
  19. $table->char('email',60)->unique('@');
  20. $table->enum('status', [1, 2, 11, 12])->default(1);
  21. $table->string('create_by');
  22. $table->timestamps();
  23. $table->string('update_by');
  24. $table->softDeletes();
  25. $table->string('delete_by');
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement