PHASE 1: Cleanup & Analyse - Feature-Konsolidierung: export_csv/json/zip → data_export (1 Feature) - Umbenennung: csv_import → data_import - Auto-Migration bei Container-Start (apply_v9c_migration.py) - Diagnose-Script (check_features.sql) Lessons Learned angewendet: - Ein Feature für Export, nicht drei - Migration ist idempotent (kann mehrfach laufen) - Zeigt BEFORE/AFTER State im Log Finaler Feature-Katalog (10 statt 13): - Data: weight, circumference, caliper, nutrition, activity, photos - AI: ai_calls, ai_pipeline - Export/Import: data_export, data_import Tier Limits: - FREE: 30 data entries, 0 AI/export/import - BASIC: unlimited data, 3 AI/month, 5 export/month, 3 import/month - PREMIUM/SELFHOSTED: unlimited Migration läuft automatisch auf dev UND prod beim Container-Start. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1: Database Migration Complete Created migration infrastructure: - backend/migrations/v9c_subscription_system.sql (11 new tables) - backend/apply_v9c_migration.py (auto-migration runner) - Updated main.py startup event to apply migration New tables (Feature-Registry Pattern): 1. app_settings - Global configuration 2. tiers - Subscription tiers (free/basic/premium/selfhosted) 3. features - Feature registry (11 limitable features) 4. tier_limits - Tier x Feature matrix (44 initial limits) 5. user_feature_restrictions - Individual user overrides 6. user_feature_usage - Usage tracking with reset periods 7. coupons - Coupon management (single-use, period, Wellpass) 8. coupon_redemptions - Redemption history 9. access_grants - Time-limited access with pause/resume logic 10. user_activity_log - Activity tracking (JSONB details) 11. user_stats - Aggregated statistics Extended profiles table: - tier, trial_ends_at, email_verified, email_verify_token - invited_by, invitation_token Initial data inserted: - 4 tiers (free/basic/premium/selfhosted) - 11 features (weight, circumference, caliper, nutrition, activity, photos, ai_calls, ai_pipeline, export_*) - 44 tier_limits (complete Tier x Feature matrix) - App settings (trial duration, self-registration config) Migration auto-runs on container startup (similar to SQLite→PostgreSQL). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>