theming, date, time localisation, additional features, seeding initial cleanup
This commit is contained in:
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Cleanup old seed scripts and organize database utilities
|
||||
# This script consolidates old individual seed scripts into the new unified system
|
||||
|
||||
echo "🧹 Cleaning up old database scripts..."
|
||||
|
||||
# Create a backup directory for old scripts
|
||||
mkdir -p scripts/old-seeds
|
||||
|
||||
# Move old individual seed scripts to backup
|
||||
echo "📦 Moving old seed scripts to scripts/old-seeds/..."
|
||||
|
||||
if [ -f "scripts/seed-data.ts" ]; then
|
||||
mv scripts/seed-data.ts scripts/old-seeds/
|
||||
echo " ✓ Moved seed-data.ts"
|
||||
fi
|
||||
|
||||
if [ -f "scripts/seed-announcements.ts" ]; then
|
||||
mv scripts/seed-announcements.ts scripts/old-seeds/
|
||||
echo " ✓ Moved seed-announcements.ts"
|
||||
fi
|
||||
|
||||
if [ -f "scripts/seed-time-slots.ts" ]; then
|
||||
mv scripts/seed-time-slots.ts scripts/old-seeds/
|
||||
echo " ✓ Moved seed-time-slots.ts"
|
||||
fi
|
||||
|
||||
if [ -f "scripts/init-admin-data.ts" ]; then
|
||||
mv scripts/init-admin-data.ts scripts/old-seeds/
|
||||
echo " ✓ Moved init-admin-data.ts"
|
||||
fi
|
||||
|
||||
# Remove old reset script if it exists
|
||||
if [ -f "scripts/reset-database.ts" ]; then
|
||||
mv scripts/reset-database.ts scripts/old-seeds/
|
||||
echo " ✓ Moved old reset-database.ts"
|
||||
fi
|
||||
|
||||
# Create a README in the old-seeds directory
|
||||
cat > scripts/old-seeds/README.md << 'EOF'
|
||||
# Old Seed Scripts (Archived)
|
||||
|
||||
These are the original individual seed scripts that have been consolidated into the new unified database setup system.
|
||||
|
||||
## Consolidated Into:
|
||||
|
||||
- **setup-database.ts** - Unified setup script with all functionality
|
||||
- **reset-db.ts** - Improved reset script with safety features
|
||||
|
||||
## Original Scripts:
|
||||
|
||||
- `seed-data.ts` - Sample bookings and activity logs
|
||||
- `seed-announcements.ts` - Test announcements
|
||||
- `seed-time-slots.ts` - Time slot configuration
|
||||
- `init-admin-data.ts` - Admin dashboard initialization
|
||||
- `reset-database.ts` - Original reset script
|
||||
|
||||
## Migration Notes:
|
||||
|
||||
All functionality from these scripts has been intelligently integrated into the new system:
|
||||
|
||||
### New Command Equivalents:
|
||||
|
||||
| Old Script | New Command |
|
||||
|------------|-------------|
|
||||
| `tsx scripts/seed-data.ts` | `npm run db:setup` |
|
||||
| `tsx scripts/seed-announcements.ts` | Integrated into setup |
|
||||
| `tsx scripts/seed-time-slots.ts` | Integrated into setup |
|
||||
| `tsx scripts/init-admin-data.ts` | Integrated into setup |
|
||||
| `tsx scripts/reset-database.ts` | `npm run db:reset-confirm` |
|
||||
|
||||
### Advantages of New System:
|
||||
|
||||
1. **Intelligent Setup** - Automatically handles dependencies and order
|
||||
2. **Flexible Options** - Essential-only or full sample data modes
|
||||
3. **Safety Features** - Reset confirmation and detailed logging
|
||||
4. **Better Documentation** - Comprehensive help and summaries
|
||||
5. **Single Source** - All database setup in one place
|
||||
|
||||
These old scripts are kept for reference but should not be used in new development.
|
||||
EOF
|
||||
|
||||
echo " ✓ Created README in old-seeds directory"
|
||||
|
||||
echo ""
|
||||
echo "✅ Cleanup complete!"
|
||||
echo ""
|
||||
echo "📋 Summary of changes:"
|
||||
echo " • Old seed scripts moved to scripts/old-seeds/"
|
||||
echo " • New unified system active:"
|
||||
echo " - setup-database.ts (comprehensive setup)"
|
||||
echo " - reset-db.ts (safe reset with confirmation)"
|
||||
echo ""
|
||||
echo "🚀 New database commands:"
|
||||
echo " npm run db:setup # Full setup with sample data"
|
||||
echo " npm run db:seed # Essential data only"
|
||||
echo " npm run db:reset # Safe reset (shows warning)"
|
||||
echo " npm run db:reset-confirm # Immediate reset"
|
||||
echo ""
|
||||
echo "📖 See DATABASE_SETUP.md for detailed documentation"
|
||||
Reference in New Issue
Block a user