2024021900-add_missing_indexes.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. declare(strict_types=1);
  3. use App\Interfaces\MigrationInterface;
  4. use App\Services\DB;
  5. return new class() implements MigrationInterface {
  6. public function up(): int
  7. {
  8. DB::getPdo()->exec('
  9. ALTER TABLE config ADD KEY IF NOT EXISTS `item` (`item`);
  10. ALTER TABLE config ADD KEY IF NOT EXISTS `class` (`class`);
  11. ALTER TABLE config ADD KEY IF NOT EXISTS `is_public` (`is_public`);
  12. ALTER TABLE hourly_usage ADD KEY IF NOT EXISTS `date` (`date`);
  13. ALTER TABLE node ADD UNIQUE KEY IF NOT EXISTS `password` (`password`);
  14. ALTER TABLE node ADD KEY IF NOT EXISTS `is_dynamic_rate` (`is_dynamic_rate`);
  15. ALTER TABLE node ADD KEY IF NOT EXISTS `bandwidthlimit_resetday` (`bandwidthlimit_resetday`);
  16. ALTER TABLE online_log ADD KEY IF NOT EXISTS `node_id` (`node_id`);
  17. ALTER TABLE payback ADD KEY IF NOT EXISTS `userid` (`userid`);
  18. ALTER TABLE payback ADD KEY IF NOT EXISTS `ref_by` (`ref_by`);
  19. ALTER TABLE payback ADD KEY IF NOT EXISTS `invoice_id` (`invoice_id`);
  20. ALTER TABLE paylist ADD UNIQUE KEY IF NOT EXISTS `tradeno` (`tradeno`);
  21. ALTER TABLE paylist ADD KEY IF NOT EXISTS `status` (`status`);
  22. ALTER TABLE paylist ADD KEY IF NOT EXISTS `invoice_id` (`invoice_id`);
  23. ALTER TABLE subscribe_log ADD KEY IF NOT EXISTS `type` (`type`);
  24. ALTER TABLE ticket ADD KEY IF NOT EXISTS `type` (`type`);
  25. ALTER TABLE user ADD KEY IF NOT EXISTS `is_shadow_banned` (`is_shadow_banned`);');
  26. return 2024021900;
  27. }
  28. public function down(): int
  29. {
  30. return 2024021900;
  31. }
  32. };