3x-ui/web/service
Ali Golzar 3850e2f070
feat: Add MySQL database support (#3024)
* feat: Add MySQL database support

- Add MySQL database support with environment-based configuration
- Fix MySQL compatibility issue with 'key' column name
- Maintain SQLite as default database
- Add proper validation for MySQL configuration
- Test and verify compatibility with existing database
- Replaced raw SQL queries using JSON_EACH functions with standard GORM queries
- Modified functions to handle JSON parsing in Go code instead of database since JSON_EACH is not available on MySQL or MariaDB:
  - getAllEmails()
  - GetClientTrafficByID()
  - getFallbackMaster()
  - MigrationRemoveOrphanedTraffics()

The system now supports both MySQL and SQLite databases, with SQLite remaining as the default option. MySQL connection is only used when explicitly configured through environment variables.

* refactor: prefix env variables of database with XUI_ to support direct environment usage without .env file

All database configuration environment variables now start with the XUI_ prefix to avoid conflicts and allow configuration via system-level environment variables, not just the .env file.
2025-05-21 12:04:38 +02:00
..
config.json outbound Traffic - default false 2025-01-26 11:22:42 +01:00
inbound.go feat: Add MySQL database support (#3024) 2025-05-21 12:04:38 +02:00
outbound.go Refactor: Use any instead of interface{} 2025-03-12 20:43:43 +01:00
panel.go improved - message logs 2024-07-08 23:47:49 +02:00
server.go fix: Restore from .db file fails (#2988) 2025-05-14 17:35:53 +02:00
setting.go feat: Add MySQL database support (#3024) 2025-05-21 12:04:38 +02:00
tgbot.go Added 3 new buttons to telegram bot (#2965) 2025-05-06 18:27:17 +02:00
user.go chore: implement 2fa auth (#2968) 2025-05-08 16:20:58 +02:00
warp.go warp - optimize utility code 2025-03-12 19:27:19 +01:00
xray.go Refactor: Use any instead of interface{} 2025-03-12 20:43:43 +01:00
xray_setting.go [warp] enhanced + delete option 2024-07-15 00:21:54 +02:00