You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
723 B

  1. <?php
  2. use Movim\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. class AddNicknameToUsersTable extends Migration
  5. {
  6. public function up()
  7. {
  8. $this->disableForeignKeyCheck();
  9. $this->schema->table('users', function (Blueprint $table) {
  10. $table->string('nickname', 64)->nullable();
  11. $table->unique('nickname');
  12. });
  13. $this->enableForeignKeyCheck();
  14. }
  15. public function down()
  16. {
  17. $this->disableForeignKeyCheck();
  18. $this->schema->table('users', function (Blueprint $table) {
  19. $table->dropUnique('users_nickname_unique');
  20. $table->dropColumn('nickname');
  21. });
  22. $this->enableForeignKeyCheck();
  23. }
  24. }