- Updated dashboard to display allocated units alongside deployed and benched units. - Introduced a quick-info modal for units, showing detailed information including calibration status, project allocation, and upcoming jobs. - Enhanced fleet calendar with a new quick-info modal for units, allowing users to view unit details without navigating away. - Modified devices table to include allocated status and visual indicators for allocated units. - Added allocated filter option in the roster view for better unit management. - Implemented backend migration to add 'allocated' and 'allocated_to_project_id' columns to the roster table. - Updated unit detail view to reflect allocated status and allow for project allocation input.
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
"""
|
|
Migration: Add allocated and allocated_to_project_id columns to roster table.
|
|
Run once: python backend/migrate_add_allocated.py
|
|
"""
|
|
import sqlite3
|
|
import os
|
|
|
|
DB_PATH = os.path.join(os.path.dirname(__file__), '..', 'data', 'seismo_fleet.db')
|
|
|
|
def run():
|
|
conn = sqlite3.connect(DB_PATH)
|
|
cur = conn.cursor()
|
|
|
|
# Check existing columns
|
|
cur.execute("PRAGMA table_info(roster)")
|
|
cols = {row[1] for row in cur.fetchall()}
|
|
|
|
if 'allocated' not in cols:
|
|
cur.execute("ALTER TABLE roster ADD COLUMN allocated BOOLEAN DEFAULT 0 NOT NULL")
|
|
print("Added column: allocated")
|
|
else:
|
|
print("Column already exists: allocated")
|
|
|
|
if 'allocated_to_project_id' not in cols:
|
|
cur.execute("ALTER TABLE roster ADD COLUMN allocated_to_project_id VARCHAR")
|
|
print("Added column: allocated_to_project_id")
|
|
else:
|
|
print("Column already exists: allocated_to_project_id")
|
|
|
|
conn.commit()
|
|
conn.close()
|
|
print("Migration complete.")
|
|
|
|
if __name__ == '__main__':
|
|
run()
|