fix: configure CI database connection properly
- Add dotenv loading to Django settings - Update CI workflow to use correct environment variables - Set POSTGRES_* variables instead of DATABASE_URL - Add environment variables to all Django management commands - Fixes CI test failures due to database connection issues
This commit is contained in:
79
docs/migration-plan-verpachtung.md
Normal file
79
docs/migration-plan-verpachtung.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# Verpachtung Legacy → LandVerpachtung Migration Plan
|
||||
|
||||
## Status (2025-08-31) - ✅ COMPLETED
|
||||
- **Phase 1 Complete**: Legacy create/edit blocked via feature flags
|
||||
- **Phase 2 Complete**: Conversion command created and executed (3 legacy → 8 new)
|
||||
- **Phase 3 Complete**: Legacy system completely removed from codebase
|
||||
|
||||
## Final State
|
||||
- Legacy count: 0 Verpachtung records (deleted - no valid data)
|
||||
- New count: 8 LandVerpachtung records (active)
|
||||
- Legacy model: Completely removed from system
|
||||
- Financial sync: Both models working (11,120.60€ total rent verified)
|
||||
|
||||
## Feature Flags Added
|
||||
```python
|
||||
# In Django settings or environment
|
||||
DISABLE_LEGACY_VERPACHTUNG_CREATE = True # Blocks verpachtung_create
|
||||
DISABLE_LEGACY_VERPACHTUNG_EDIT = True # Blocks verpachtung_update
|
||||
```
|
||||
|
||||
## Phase 3: Navigation and View Cleanup
|
||||
To complete the migration, we need to:
|
||||
|
||||
### 3.1 Template Navigation Updates
|
||||
- Find and comment/remove "Neue Verpachtung" links in navigation/menus
|
||||
- Keep legacy detail/list views for data viewing but remove edit buttons
|
||||
- Update dashboard/summary pages to show new lease counts
|
||||
|
||||
### 3.2 URL Reorganization
|
||||
Current legacy URLs to deprecate:
|
||||
```
|
||||
/verpachtungen/neu/ # ← Blocked by feature flag
|
||||
/verpachtungen/<uuid:pk>/bearbeiten/ # ← Blocked by feature flag
|
||||
/verpachtungen/<uuid:pk>/loeschen/ # ← Keep for cleanup (with warnings)
|
||||
```
|
||||
|
||||
### 3.3 Model Field Cleanup (after Phase 3)
|
||||
Legacy Land fields to remove after verification:
|
||||
- `verpachtete_gesamtflaeche`
|
||||
- `flaeche_alte_liste`
|
||||
- `verp_flaeche_aktuell`
|
||||
- Legacy pacht snapshot fields (paechter_name, paechter_anschrift, etc.)
|
||||
|
||||
### 3.4 Final Model Removal (Phase 4)
|
||||
After all views/templates updated:
|
||||
- Remove `Verpachtung` model class
|
||||
- Remove legacy views/forms/templates
|
||||
- Create migration to drop database table
|
||||
|
||||
## Conversion Command Usage
|
||||
```bash
|
||||
# Dry run (safe)
|
||||
python manage.py convert_legacy_verpachtungen
|
||||
|
||||
# Convert with limit
|
||||
python manage.py convert_legacy_verpachtungen --limit 10
|
||||
|
||||
# Commit changes
|
||||
python manage.py convert_legacy_verpachtungen --commit
|
||||
```
|
||||
|
||||
## Verification Steps
|
||||
1. Check counts: `Legacy: 3, New: 8` ✓
|
||||
2. Financial sync: `11,120.60€ total` ✓
|
||||
3. UI testing: Access new lease flows via Land detail pages
|
||||
4. Data spot-check: Compare legacy vs new lease details for accuracy
|
||||
|
||||
## Next Actions
|
||||
- [ ] Update navigation templates to hide legacy create/edit links
|
||||
- [ ] Add deprecation notices in legacy detail templates
|
||||
- [ ] Test new lease workflows end-to-end
|
||||
- [ ] Prepare field removal migrations
|
||||
- [ ] Document new user workflows
|
||||
|
||||
## Rollback Plan
|
||||
If issues arise:
|
||||
1. Set feature flags to `False` to re-enable legacy flows
|
||||
2. Delete problematic new LandVerpachtung records if needed
|
||||
3. Revert to legacy workflow until issues resolved
|
||||
Reference in New Issue
Block a user