Refactor event and session column names to camelCase

- Updated test cases to reflect new column names (eve_MAC -> eveMac, eve_DateTime -> eveDateTime, etc.) across various test files.
- Modified SQL table definitions in the database cleanup and migration tests to use camelCase naming conventions.
- Implemented migration tests to ensure legacy column names are correctly renamed to camelCase equivalents.
- Ensured that existing data is preserved during the migration process and that views referencing old column names are dropped before renaming.
- Verified that the migration function is idempotent, allowing for safe re-execution without data loss.
This commit is contained in:
Jokob @NetAlertX
2026-03-16 10:11:22 +00:00
parent 0bb6db155b
commit c7399215ec
109 changed files with 2403 additions and 1967 deletions

View File

@@ -35,18 +35,18 @@ class PluginObjectInstance:
def getByGUID(self, ObjectGUID):
return self._fetchone(
"SELECT * FROM Plugins_Objects WHERE ObjectGUID = ?", (ObjectGUID,)
"SELECT * FROM Plugins_Objects WHERE objectGuid = ?", (ObjectGUID,)
)
def exists(self, ObjectGUID):
row = self._fetchone("""
SELECT COUNT(*) AS count FROM Plugins_Objects WHERE ObjectGUID = ?
SELECT COUNT(*) AS count FROM Plugins_Objects WHERE objectGuid = ?
""", (ObjectGUID,))
return row["count"] > 0 if row else False
def getByPlugin(self, plugin):
return self._fetchall(
"SELECT * FROM Plugins_Objects WHERE Plugin = ?", (plugin,)
"SELECT * FROM Plugins_Objects WHERE plugin = ?", (plugin,)
)
def getLastNCreatedPerPlugin(self, plugin, entries=1):
@@ -54,8 +54,8 @@ class PluginObjectInstance:
"""
SELECT *
FROM Plugins_Objects
WHERE Plugin = ?
ORDER BY DateTimeCreated DESC
WHERE plugin = ?
ORDER BY dateTimeCreated DESC
LIMIT ?
""",
(plugin, entries),
@@ -63,7 +63,7 @@ class PluginObjectInstance:
def getByField(self, plugPrefix, matchedColumn, matchedKey, returnFields=None):
rows = self._fetchall(
f"SELECT * FROM Plugins_Objects WHERE Plugin = ? AND {matchedColumn} = ?",
f"SELECT * FROM Plugins_Objects WHERE plugin = ? AND {matchedColumn} = ?",
(plugPrefix, matchedKey.lower())
)
@@ -75,12 +75,12 @@ class PluginObjectInstance:
def getByPrimary(self, plugin, primary_id):
return self._fetchall("""
SELECT * FROM Plugins_Objects
WHERE Plugin = ? AND Object_PrimaryID = ?
WHERE plugin = ? AND objectPrimaryId = ?
""", (plugin, primary_id))
def getByStatus(self, status):
return self._fetchall("""
SELECT * FROM Plugins_Objects WHERE Status = ?
SELECT * FROM Plugins_Objects WHERE "status" = ?
""", (status,))
def updateField(self, ObjectGUID, field, value):
@@ -90,7 +90,7 @@ class PluginObjectInstance:
raise ValueError(msg)
self._execute(
f"UPDATE Plugins_Objects SET {field}=? WHERE ObjectGUID=?",
f"UPDATE Plugins_Objects SET {field}=? WHERE objectGuid=?",
(value, ObjectGUID)
)
@@ -100,4 +100,4 @@ class PluginObjectInstance:
mylog("none", msg)
raise ValueError(msg)
self._execute("DELETE FROM Plugins_Objects WHERE ObjectGUID=?", (ObjectGUID,))
self._execute("DELETE FROM Plugins_Objects WHERE objectGuid=?", (ObjectGUID,))