| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- return new class extends Migration {
- public function up()
- {
- Schema::table('activity_rewards', function (Blueprint $table) {
- $table->json('publish_platforms')->nullable()->comment('发布平台PC/H5/APP,空表示全部');
- $table->decimal('budget', 14, 2)->nullable()->comment('奖励总预算,NULL不限,0停止发奖');
- $table->decimal('budget_used', 14, 2)->default(0)->comment('上线后已发奖励总额');
- $table->unsignedInteger('sort')->default(0);
- $table->boolean('register_time_limited')->default(false);
- $table->dateTime('register_start_time')->nullable();
- $table->dateTime('register_end_time')->nullable();
- $table->json('register_platforms')->nullable()->comment('会员首次成功登录平台,空表示全部');
- $table->boolean('deposit_limited')->default(false);
- $table->decimal('deposit_min', 14, 2)->nullable();
- $table->decimal('deposit_max', 14, 2)->nullable();
- $table->boolean('show_ineligible')->default(true)->comment('不符合会员资格时是否展示');
- });
- if (Schema::hasTable('yuebao_item') && !Schema::hasColumn('yuebao_item', 'activity_id')) {
- Schema::table('yuebao_item', function (Blueprint $table) {
- $table->unsignedBigInteger('activity_id')->nullable()->index()->comment('新持仓关联活动预算');
- });
- }
- }
- public function down()
- {
- if (Schema::hasTable('yuebao_item') && Schema::hasColumn('yuebao_item', 'activity_id')) {
- Schema::table('yuebao_item', function (Blueprint $table) {
- $table->dropIndex(['activity_id']);
- $table->dropColumn('activity_id');
- });
- }
- Schema::table('activity_rewards', function (Blueprint $table) {
- $table->dropColumn(['publish_platforms', 'budget', 'budget_used', 'sort',
- 'register_time_limited', 'register_start_time', 'register_end_time',
- 'register_platforms', 'deposit_limited', 'deposit_min', 'deposit_max', 'show_ineligible']);
- });
- }
- };
|