✨ New Features: - Complete Smart Package System with 6 B7 package types - Enhanced geometry validation with ridgeHeight support - Automatic material quantity calculations (2.13 plates/m², 2.17m batten/m²) - Intelligent labor hour calculations (580 DKK/hour) - Total price calculations with VAT (realistic 800 DKK/m² for B7 roofs) 🔧 Backend Improvements: - Enhanced PackageService with real Bygma material integration - Improved CustomerProjects API with package management - ProjectMaterialService with advanced calculations - Ridge height validation (0.5-8.0m range) 🎨 Frontend Enhancements: - Enhanced geometry input component with validation - Improved SmartPackage components with better UX - Real-time package selection and pricing display 📦 Deployment & Operations: - Complete database migration scripts - Nginx configurations for production deployment - Build and test automation scripts - Implementation progress documentation 🧪 System Verification: - Full end-to-end workflow testing completed - All calculations validated with realistic pricing - 165m² B7 project: 132,770 DKK total (competitive market rate) - Ready for production carpenter use!
76 lines
2.0 KiB
Bash
Executable File
76 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
# Simple Database Import Script
|
||
# Fixes definer issues and imports the database
|
||
|
||
set -e
|
||
|
||
# Colors for output
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
BLUE='\033[0;34m'
|
||
NC='\033[0m'
|
||
|
||
error() {
|
||
echo -e "${RED}❌ ERROR: $1${NC}"
|
||
exit 1
|
||
}
|
||
|
||
success() {
|
||
echo -e "${GREEN}✅ $1${NC}"
|
||
}
|
||
|
||
info() {
|
||
echo -e "${BLUE}ℹ️ $1${NC}"
|
||
}
|
||
|
||
BACKUP_FILE="/tmp/tilbudgivern_migration/tilbudgivern_backup_20251010_083710.sql"
|
||
CLEANED_FILE="/tmp/tilbudgivern_migration/cleaned_backup.sql"
|
||
|
||
if [ ! -f "$BACKUP_FILE" ]; then
|
||
error "Backup file not found: $BACKUP_FILE"
|
||
fi
|
||
|
||
info "Cleaning backup file to remove definer issues..."
|
||
|
||
# Remove definer clauses and other problematic elements
|
||
sed -e 's/DEFINER=[^*]*\*/\*/g' \
|
||
-e 's/SQL SECURITY DEFINER//g' \
|
||
-e '/^\/\*!50017 DEFINER=/d' \
|
||
"$BACKUP_FILE" > "$CLEANED_FILE"
|
||
|
||
success "Backup file cleaned"
|
||
|
||
info "Importing database (this may take a few minutes)..."
|
||
|
||
# Import with error handling
|
||
if mysql -u tilbuduser -ptilbudpass123 tilbudgivern < "$CLEANED_FILE"; then
|
||
success "Database imported successfully!"
|
||
else
|
||
error "Database import failed"
|
||
fi
|
||
|
||
# Verify import
|
||
info "Verifying database import..."
|
||
TABLE_COUNT=$(mysql -u tilbuduser -ptilbudpass123 -e "USE tilbudgivern; SHOW TABLES;" 2>/dev/null | wc -l)
|
||
|
||
if [ "$TABLE_COUNT" -gt 1 ]; then
|
||
success "Database verification OK - Found $(($TABLE_COUNT - 1)) tables"
|
||
|
||
# Show some basic stats
|
||
echo ""
|
||
info "Database import summary:"
|
||
mysql -u tilbuduser -ptilbudpass123 -e "
|
||
USE tilbudgivern;
|
||
SELECT 'Tables imported:' as info, COUNT(*) as count FROM information_schema.tables WHERE table_schema = 'tilbudgivern'
|
||
UNION ALL
|
||
SELECT 'customer_projects', COUNT(*) FROM customer_projects
|
||
UNION ALL
|
||
SELECT 'project_quotes', COUNT(*) FROM project_quotes;
|
||
" 2>/dev/null
|
||
else
|
||
error "Database verification failed - No tables found"
|
||
fi
|
||
|
||
success "Database migration completed successfully!" |