Remove migration code and alembic dependency
This commit is contained in:
@@ -4,7 +4,7 @@ This service handles:
|
||||
- Loading and saving configuration to JSON files
|
||||
- Configuration validation
|
||||
- Backup and restore functionality
|
||||
- Configuration migration for version updates
|
||||
- Configuration version management
|
||||
"""
|
||||
|
||||
import json
|
||||
@@ -35,8 +35,8 @@ class ConfigBackupError(ConfigServiceError):
|
||||
class ConfigService:
|
||||
"""Service for managing application configuration persistence.
|
||||
|
||||
Handles loading, saving, validation, backup, and migration of
|
||||
configuration files. Uses JSON format for human-readable and
|
||||
Handles loading, saving, validation, backup, and version management
|
||||
of configuration files. Uses JSON format for human-readable and
|
||||
version-control friendly storage.
|
||||
"""
|
||||
|
||||
@@ -84,11 +84,6 @@ class ConfigService:
|
||||
with open(self.config_path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
# Check if migration is needed
|
||||
file_version = data.get("version", "1.0.0")
|
||||
if file_version != self.CONFIG_VERSION:
|
||||
data = self._migrate_config(data, file_version)
|
||||
|
||||
# Remove version key before constructing AppConfig
|
||||
data.pop("version", None)
|
||||
|
||||
@@ -328,26 +323,6 @@ class ConfigService:
|
||||
except (OSError, IOError):
|
||||
# Ignore errors during cleanup
|
||||
continue
|
||||
|
||||
def _migrate_config(
|
||||
self, data: Dict, from_version: str # noqa: ARG002
|
||||
) -> Dict:
|
||||
"""Migrate configuration from old version to current.
|
||||
|
||||
Args:
|
||||
data: Configuration data to migrate
|
||||
from_version: Version to migrate from (reserved for future use)
|
||||
|
||||
Returns:
|
||||
Dict: Migrated configuration data
|
||||
"""
|
||||
# Currently only one version exists
|
||||
# Future migrations would go here
|
||||
# Example:
|
||||
# if from_version == "1.0.0" and self.CONFIG_VERSION == "2.0.0":
|
||||
# data = self._migrate_1_0_to_2_0(data)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
# Singleton instance
|
||||
|
||||
Reference in New Issue
Block a user