create_shipping_tables.php.stub 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /*
  3. * This file is part of ibrand/shipping.
  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 CreateShippingTables 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. Schema::create($prefix . 'shipping_method', function (Blueprint $table) {
  24. $table->increments('id');
  25. $table->string('code');
  26. $table->string('name');
  27. $table->string('url')->nullable();
  28. $table->boolean('is_enabled')->default(true);
  29. $table->timestamps();
  30. $table->softDeletes();
  31. });
  32. Schema::create($prefix . 'shipping', function (Blueprint $table) {
  33. $table->increments('id');
  34. $table->integer('method_id');
  35. $table->integer('order_id');
  36. $table->string('tracking')->nullable(); //快递单号
  37. $table->timestamp('delivery_time')->nullable();
  38. $table->timestamps();
  39. $table->softDeletes();
  40. });
  41. }
  42. /**
  43. * Reverse the migrations.
  44. *
  45. * @return void
  46. */
  47. public function down()
  48. {
  49. $prefix = config('ibrand.app.database.prefix') ?? 'ibrand_';
  50. Schema::dropIfExists($prefix . 'shipping');
  51. Schema::dropIfExists($prefix . 'shipping_method');
  52. }
  53. }