many updates
This commit is contained in:
18
FitnessSync/backend/backfill_estimated_power.py
Normal file
18
FitnessSync/backend/backfill_estimated_power.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from src.services.postgresql_manager import PostgreSQLManager
|
||||
from src.utils.config import config
|
||||
from src.models.activity import Activity
|
||||
from sqlalchemy import text
|
||||
|
||||
def backfill():
|
||||
print("Backfilling is_estimated_power defaults...")
|
||||
db_manager = PostgreSQLManager(config.DATABASE_URL)
|
||||
with db_manager.get_db_session() as session:
|
||||
# Update all NULLs to False
|
||||
result = session.execute(
|
||||
text("UPDATE activities SET is_estimated_power = false WHERE is_estimated_power IS NULL")
|
||||
)
|
||||
session.commit()
|
||||
print(f"Updated {result.rowcount} rows.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
backfill()
|
||||
Reference in New Issue
Block a user