codex changes

This commit is contained in:
Jake Kasper
2025-09-02 07:02:34 -05:00
parent e75be978fa
commit 4853eff749
6 changed files with 171 additions and 42 deletions

View File

@@ -0,0 +1,26 @@
-- Performance indexes for common queries and joins
-- Application plans
CREATE INDEX IF NOT EXISTS idx_application_plans_user_id ON application_plans(user_id);
CREATE INDEX IF NOT EXISTS idx_application_plans_user_status ON application_plans(user_id, status);
CREATE INDEX IF NOT EXISTS idx_application_plans_user_planned_date ON application_plans(user_id, planned_date);
-- Application plan products
CREATE INDEX IF NOT EXISTS idx_application_plan_products_plan_id ON application_plan_products(plan_id);
-- Properties and lawn sections
CREATE INDEX IF NOT EXISTS idx_properties_user_id ON properties(user_id);
CREATE INDEX IF NOT EXISTS idx_lawn_sections_property_id ON lawn_sections(property_id);
-- User equipment
CREATE INDEX IF NOT EXISTS idx_user_equipment_user_id ON user_equipment(user_id);
-- User products and products
CREATE INDEX IF NOT EXISTS idx_user_products_user_id ON user_products(user_id);
CREATE INDEX IF NOT EXISTS idx_products_category_id ON products(category_id);
-- Weather logs (if present)
-- CREATE INDEX IF NOT EXISTS idx_weather_logs_property_id ON weather_logs(property_id);
SELECT 'Core indexes added' AS migration_status;