Replace all ~1,086 occurrences of Wizamart/wizamart/WIZAMART/WizaMart with Orion/orion/ORION across 184 files. This includes database identifiers, email addresses, domain references, R2 bucket names, DNS prefixes, encryption salt, Celery app name, config defaults, Docker configs, CI configs, documentation, seed data, and templates. Renames homepage-wizamart.html template to homepage-orion.html. Fixes duplicate file_pattern key in api.yaml architecture rule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.9 KiB
4.9 KiB
Database Commands - Quick Reference
🚀 Common Workflows
First-Time Development Setup
make migrate-up # Apply migrations
make init-prod # Create admin user
make seed-demo # Add demo data
make dev # Start developing
First-Time Production Setup
# 1. Configure .env
ENVIRONMENT=production
ADMIN_EMAIL=admin@yourmerchant.com
ADMIN_PASSWORD=SecurePassword123!
# 2. Initialize
make migrate-up
make init-prod
# 3. Create stores via admin panel
Daily Development
make dev # Start server
make seed-demo-reset # Fresh demo data
make test # Run tests
📋 Command Reference
Database Migrations
make migrate-create message="add_feature" # Create migration
make migrate-up # Apply migrations
make migrate-down # Rollback last
make migrate-status # Check status
Initialization
make init-prod # Create admin + settings (SAFE for production)
Demo Data (Development Only)
make seed-demo # 3 stores + data
make seed-demo-minimal # 1 store only
make seed-demo-reset # DELETE ALL + reseed (DANGEROUS!)
Complete Workflows
make db-setup # migrate + init + seed
make db-reset # rollback + migrate + reset
⚙️ Configuration (.env)
Required Settings
ENVIRONMENT=development # development/staging/production
DATABASE_URL=sqlite:///./orion.db
# Admin credentials (CHANGE IN PRODUCTION!)
ADMIN_EMAIL=admin@orion.lu
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin123
Demo Data Controls
SEED_DEMO_STORES=3 # How many stores
SEED_CUSTOMERS_PER_STORE=15 # Customers per store
SEED_PRODUCTS_PER_STORE=20 # Products per store
Using Settings in Code
from app.core.config import settings
# Environment checks
if settings.is_production:
# Production code
# Access configuration
email = settings.admin_email
db_url = settings.database_url
🔐 Default Credentials
Admin (After init-prod)
URL: http://localhost:8000/admin/login
Username: admin
Password: admin123 (CHANGE IN PRODUCTION!)
Demo Stores (After seed-demo)
Store 1: store1@example.com / password123
Store 2: store2@example.com / password123
Store 3: store3@example.com / password123
⚠️ All demo passwords are INSECURE - for development only!
📊 What Each Command Creates
make init-prod
✅ Platform admin user ✅ Admin settings ✅ Role templates ✅ RBAC schema verification
Safe for production: YES Contains fake data: NO
make seed-demo
✅ 3 demo stores ✅ Demo store users ✅ ~45 customers (15 per store) ✅ ~60 products (20 per store) ✅ Store themes ✅ Custom domains
Safe for production: NO Contains fake data: YES - ALL OF IT
make seed-demo-minimal
✅ 1 demo store ✅ 1 demo store user ✅ ~15 customers ✅ ~20 products ✅ Store theme ✅ Custom domain
Safe for production: NO Contains fake data: YES
🚨 Safety Features
Production Warnings
# Automatically warns if:
⚠️ Using default admin password
⚠️ Using default JWT secret
⚠️ Debug mode enabled in production
⚠️ ALLOWED_HOSTS is wildcard
Environment Protection
# seed_demo.py refuses to run if:
ENVIRONMENT=production
Error: Cannot run demo seeding in production!
Reset Confirmation
make seed-demo-reset
# Requires typing: DELETE ALL DATA
🔍 Verification Commands
Check Database State
# Quick check
python -c "
from app.core.database import SessionLocal
from models.database.store import Store
db = SessionLocal()
print(f'Stores: {db.query(Store).count()}')
db.close()
"
View Settings
# Check configuration
python -c "
from app.core.config import settings, print_environment_info
print_environment_info()
"
Validate Production
# Check production security
python -c "
from app.core.config import validate_production_settings
warnings = validate_production_settings()
if warnings:
for w in warnings: print(w)
else:
print('✅ Production configuration is secure')
"
🆘 Common Issues
"Admin already exists"
✅ Normal! init_production.py is idempotent (safe to run multiple times)
"Table doesn't exist"
❌ Run migrations first: make migrate-up
"Cannot run in production"
✅ Correct behavior! seed_demo.py blocks production usage
"Default password warning"
⚠️ Update .env with secure password in production
📚 More Help
make help # All commands
make help-db # Database-specific help
Documentation:
database-init-guide.md- Detailed guideMIGRATION_GUIDE.md- Migration from old systemREADME.md- Project overview