mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-12-16 13:29:42 +01:00
Add resource limits columns to upgrade script
Add database migrations for 7 new resource limit fields in packages_package table to support users upgrading from older CyberPanel versions: - memoryLimitMB (default: 1024) - cpuCores (default: 1) - ioLimitMBPS (default: 10) - inodeLimit (default: 400000) - maxConnections (default: 10) - procSoftLimit (default: 400) - procHardLimit (default: 500) These columns are automatically added during upgrade via CLMigrations() function. Uses try/except to safely handle cases where columns already exist.
This commit is contained in:
@@ -2489,6 +2489,49 @@ CREATE TABLE `websiteFunctions_backupsv2` (`id` integer AUTO_INCREMENT NOT NULL
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
## Resource Limits columns for cgroups v2 integration
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN memoryLimitMB INT DEFAULT 1024;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN cpuCores INT DEFAULT 1;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN ioLimitMBPS INT DEFAULT 10;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN inodeLimit INT DEFAULT 400000;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN maxConnections INT DEFAULT 10;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN procSoftLimit INT DEFAULT 400;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
query = "ALTER TABLE packages_package ADD COLUMN procHardLimit INT DEFAULT 500;"
|
||||||
|
try:
|
||||||
|
cursor.execute(query)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.close()
|
connection.close()
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user