2026_10_25_180000_create_reward_grant_settings.php 958 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Facades\Schema;
  6. return new class extends Migration {
  7. public function up()
  8. {
  9. Schema::create('reward_grant_settings', function (Blueprint $table) {
  10. $table->engine = 'InnoDB';
  11. $table->string('type', 16)->primary();
  12. $table->boolean('auto_enabled')->default(false);
  13. $table->char('grant_time', 5)->default('03:00');
  14. $table->timestamps();
  15. });
  16. foreach (['rebate', 'backflow'] as $type) {
  17. DB::table('reward_grant_settings')->insert([
  18. 'type' => $type, 'auto_enabled' => false, 'grant_time' => '03:00',
  19. 'created_at' => now(), 'updated_at' => now(),
  20. ]);
  21. }
  22. }
  23. public function down()
  24. {
  25. Schema::dropIfExists('reward_grant_settings');
  26. }
  27. };