NewVersionPrepare.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Modules\User\Models\QappUser;
  4. use Illuminate\Console\Command;
  5. use Illuminate\Database\Schema\Blueprint;
  6. use Illuminate\Support\Facades\DB;
  7. use Illuminate\Support\Facades\Schema;
  8. class NewVersionPrepare extends Command
  9. {
  10. /**
  11. * The name and signature of the console command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'new_viersion_prepare';
  16. /**
  17. * The console command description.
  18. *
  19. * @var string
  20. */
  21. protected $description = '新版本上线准备';
  22. /**
  23. * Create a new command instance.
  24. *
  25. * @return void
  26. */
  27. public function __construct()
  28. {
  29. parent::__construct();
  30. }
  31. /**
  32. * Execute the console command.
  33. *
  34. * @return mixed
  35. */
  36. public function handle()
  37. {
  38. if (!Schema::hasColumn('qapp_users', 'channel_id')) {
  39. Schema::table('qapp_users', function (Blueprint $table) {
  40. $table->unsignedInteger('channel_id');
  41. $table->dropIndex('device_no');
  42. $table->index(['device_no', 'channel_id'], 'idx_device_no');
  43. });
  44. DB::table('qapp_users')->update(['channel_id' => env('QUICKAPP_SITE')]);
  45. }
  46. if (!Schema::hasTable('qapp_package_info')) {
  47. Schema::create('qapp_package_info', function (Blueprint $table) {
  48. $table->increments('id');
  49. $table->integer('channel_id');
  50. $table->string('package', 255);
  51. $table->string('company', 255);
  52. $table->integer('app_pay_merchat_id');
  53. $table->integer('h5_pay_merchat_id');
  54. $table->integer('ali_pay_merchat_id');
  55. $table->timestamps();
  56. });
  57. }
  58. }
  59. }