create_addresses_tables.php.stub 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * This file is part of ibrand/address.
  4. *
  5. * (c) iBrand <https://www.ibrand.cc>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Illuminate\Support\Facades\Schema;
  11. use Illuminate\Database\Schema\Blueprint;
  12. use Illuminate\Database\Migrations\Migration;
  13. class CreateAddressesTables extends Migration
  14. {
  15. /**
  16. * Run the migrations.
  17. *
  18. * @return void
  19. */
  20. public function up()
  21. {
  22. $prefix = config('ibrand.app.database.prefix', 'ibrand_');
  23. if (!Schema::hasTable($prefix . 'addresses')) {
  24. Schema::create($prefix . 'addresses', function (Blueprint $table) {
  25. $table->increments('id');
  26. $table->integer('user_id');
  27. $table->string('accept_name');
  28. $table->string('mobile');
  29. $table->integer('province')->nullable();
  30. $table->integer('city')->nullable();
  31. $table->integer('area')->nullable();
  32. $table->string('address_name');
  33. $table->string('address');
  34. $table->tinyInteger('is_default')->default(0);
  35. $table->timestamps();
  36. $table->softDeletes();
  37. });
  38. }
  39. }
  40. /**
  41. * Reverse the migrations.
  42. *
  43. * @return void
  44. */
  45. public function down()
  46. {
  47. $prefix = config('ibrand.app.database.prefix', 'ibrand_');
  48. Schema::dropIfExists($prefix.'addresses');
  49. }
  50. }