Renamed all documentation files to follow kebab-case naming standard: - UPPERCASE files → lowercase (e.g., RBAC.md → rbac.md) - snake_case files → kebab-case (e.g., icons_guide.md → icons-guide.md) - SCREAMING_SNAKE_CASE → kebab-case (e.g., DATABASE_SETUP_GUIDE.md → database-setup-guide.md) Files renamed (15 total): API Documentation: - api/RBAC.md → api/rbac.md Architecture: - architecture/API_CONSOLIDATION_PROPOSAL.md → api-consolidation-proposal.md - architecture/API_MIGRATION_STATUS.md → api-migration-status.md Development: - development/AUTH_DEPENDENCIES_GUIDE.md → auth-dependencies-guide.md - development/CUSTOMER_AUTHENTICATION_IMPLEMENTATION.md → customer-authentication-implementation.md - development/CUSTOMER_AUTH_SUMMARY.md → customer-auth-summary.md - development/icons_guide.md → icons-guide.md Database Seeder: - database-seeder/DATABASE_INIT_GUIDE.md → database-init-guide.md - database-seeder/DATABASE_QUICK_REFERENCE_GUIDE.md → database-quick-reference-guide.md - database-seeder/DATABASE_SEEDER_DOCUMENTATION.md → database-seeder-documentation.md - database-seeder/MAKEFILE_DATABASE_SEEDER.md → makefile-database-seeder.md Error Rendering: - error-rendering/ERROR_RENDERING_DEVELOPER_DOCUMENTATION.md → error-rendering-developer-documentation.md - error-rendering/HTML_ERROR_RENDERING_FLOW_DIAGRAM.md → html-error-rendering-flow-diagram.md Getting Started: - getting-started/DATABASE_QUICK_REFERENCE.md → database-quick-reference.md - getting-started/DATABASE_SETUP_GUIDE.md → database-setup-guide.md Updates: - Updated all references in mkdocs.yml - Updated all cross-references in markdown files - Verified mkdocs builds without warnings or errors Standard: Use kebab-case (lowercase-with-hyphens) for all markdown files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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@yourcompany.com
ADMIN_PASSWORD=SecurePassword123!
# 2. Initialize
make migrate-up
make init-prod
# 3. Create vendors 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 vendors + data
make seed-demo-minimal # 1 vendor 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:///./wizamart.db
# Admin credentials (CHANGE IN PRODUCTION!)
ADMIN_EMAIL=admin@wizamart.com
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin123
Demo Data Controls
SEED_DEMO_VENDORS=3 # How many vendors
SEED_CUSTOMERS_PER_VENDOR=15 # Customers per vendor
SEED_PRODUCTS_PER_VENDOR=20 # Products per vendor
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 Vendors (After seed-demo)
Vendor 1: vendor1@example.com / password123
Vendor 2: vendor2@example.com / password123
Vendor 3: vendor3@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 vendors
✅ Demo vendor users
✅ ~45 customers (15 per vendor)
✅ ~60 products (20 per vendor)
✅ Vendor themes
✅ Custom domains
Safe for production: NO
Contains fake data: YES - ALL OF IT
make seed-demo-minimal
✅ 1 demo vendor
✅ 1 demo vendor user
✅ ~15 customers
✅ ~20 products
✅ Vendor 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.vendor import Vendor
db = SessionLocal()
print(f'Vendors: {db.query(Vendor).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