feat: Add combined track functionality with repository and service layers
- Introduced CombinedTrackModel, CombinedTrackCreate, and CombinedTrackRepository for managing combined tracks. - Implemented logic to create combined tracks based on existing tracks between two stations. - Added methods to check for existing combined tracks and retrieve constituent track IDs. - Enhanced TrackModel and TrackRepository to support OSM ID and track updates. - Created migration scripts for adding combined tracks table and OSM ID to tracks. - Updated services and API endpoints to handle combined track operations. - Added tests for combined track creation, repository methods, and API interactions.
This commit is contained in:
@@ -62,13 +62,23 @@ def check_database_url():
|
||||
print(f"Using database: {database_url}")
|
||||
|
||||
|
||||
def run_command(cmd, cwd=None, description=""):
|
||||
def run_command(cmd, cwd=None, description="", env=None):
|
||||
"""Run a shell command and return the result."""
|
||||
print(f"\n>>> {description}")
|
||||
print(f"Running: {' '.join(cmd)}")
|
||||
try:
|
||||
result = subprocess.run(cmd, cwd=cwd, check=True,
|
||||
capture_output=True, text=True)
|
||||
env_vars = os.environ.copy()
|
||||
if env:
|
||||
env_vars.update(env)
|
||||
env_vars.setdefault("PYTHONPATH", "/app")
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
cwd=cwd,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
env=env_vars,
|
||||
)
|
||||
if result.stdout:
|
||||
print(result.stdout)
|
||||
return result
|
||||
@@ -86,7 +96,7 @@ def run_migrations():
|
||||
run_command(
|
||||
['alembic', 'upgrade', 'head'],
|
||||
cwd='backend',
|
||||
description="Running database migrations"
|
||||
description="Running database migrations",
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user