data seed feature for demo and prod
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
||||
# Product Independence - Quick Reference
|
||||
|
||||
## TL;DR
|
||||
|
||||
**Problem:** Products must have a MarketplaceProduct entry, even for vendor-created products.
|
||||
|
||||
**Solution:** Make `marketplace_product_id` nullable and add core product fields to Product table.
|
||||
|
||||
**Impact:** 6-8 weeks implementation, requires database migration.
|
||||
|
||||
---
|
||||
|
||||
## Current Blocker for Seed Script
|
||||
|
||||
The seed script fails because it tries to create standalone products, but the current schema requires:
|
||||
|
||||
```python
|
||||
marketplace_product_id = Column(..., nullable=False) # ❌ MANDATORY
|
||||
```
|
||||
|
||||
### Temporary Workaround (Current Seed Script)
|
||||
|
||||
Create MarketplaceProduct for every Product until migration is complete:
|
||||
|
||||
```python
|
||||
# For each product:
|
||||
# 1. Create MarketplaceProduct
|
||||
# 2. Create Product linked to it
|
||||
```
|
||||
|
||||
This works but violates the desired architecture.
|
||||
|
||||
---
|
||||
|
||||
## Quick Decision Matrix
|
||||
|
||||
| Question | Answer | Priority |
|
||||
|----------|--------|----------|
|
||||
| Implement now? | Not urgent - current workaround functional | Medium |
|
||||
| Block for launch? | No - can ship with current architecture | N/A |
|
||||
| Technical debt? | Yes - should address in 1-2 quarters | Medium-High |
|
||||
|
||||
---
|
||||
|
||||
## Minimal Implementation (if needed quickly)
|
||||
|
||||
**Phase 1 Only - Make nullable:**
|
||||
|
||||
```python
|
||||
# 1 hour migration
|
||||
def upgrade():
|
||||
op.alter_column('products', 'marketplace_product_id', nullable=True)
|
||||
op.add_column('products', sa.Column('title', sa.String(), nullable=True))
|
||||
op.add_column('products', sa.Column('gtin', sa.String(), nullable=True))
|
||||
# Add only critical fields
|
||||
|
||||
# Updated model
|
||||
class Product:
|
||||
marketplace_product_id = Column(Integer, ForeignKey(...), nullable=True) # ✅
|
||||
title = Column(String, nullable=True) # Temp nullable
|
||||
gtin = Column(String, nullable=True)
|
||||
```
|
||||
|
||||
Then gradually add remaining fields in future migrations.
|
||||
|
||||
---
|
||||
|
||||
## Key Stakeholders to Consult
|
||||
|
||||
- [ ] Product Manager - Business impact, priority
|
||||
- [ ] Lead Developer - Technical approach, timeline
|
||||
- [ ] DevOps - Migration strategy, rollback plan
|
||||
- [ ] Vendors (if beta testing) - Feature importance
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Review full migration plan:** `/outputs/PRODUCT_MIGRATION_PLAN.md`
|
||||
2. **Discuss with team** - Get buy-in on approach
|
||||
3. **Schedule implementation** - Based on priority
|
||||
4. **Create tracking ticket** - Link to migration plan
|
||||
|
||||
---
|
||||
|
||||
## For Now: Use Workaround
|
||||
|
||||
The updated `seed_demo.py` creates both MarketplaceProduct and Product.
|
||||
This is temporary until migration is implemented.
|
||||
|
||||
**No immediate action required** - continue development with current architecture.
|
||||
Reference in New Issue
Block a user