- Add migration to correct 14 colors that should be refill-only - Create helper script for applying the fix - Add frontend tracking for refill-only colors - Update README with current project state - Add development guidance documentation
66 lines
1.7 KiB
Bash
Executable File
66 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script to fix refill-only colors that incorrectly have spool availability
|
|
# These colors should have spulna = 0 (no regular spools available)
|
|
|
|
echo "🔧 Fixing refill-only colors to have 0 spools..."
|
|
|
|
# Colors that should be refill-only
|
|
REFILL_ONLY_COLORS=(
|
|
"Nardo Gray"
|
|
"Blue Grey"
|
|
"Light Gray"
|
|
"Brown"
|
|
"Beige"
|
|
"Bronze"
|
|
"Purple"
|
|
"Cobalt Blue"
|
|
"Turquoise"
|
|
"Bright Green"
|
|
"Yellow"
|
|
"Gold"
|
|
"Orange"
|
|
"Maroon Red"
|
|
)
|
|
|
|
# Database connection details
|
|
DB_HOST="filamenteka.ci7fsdlbzmag.eu-central-1.rds.amazonaws.com"
|
|
DB_NAME="filamenteka"
|
|
DB_USER="filamenteka_admin"
|
|
DB_PASSWORD="onrBjiAjHKQXBAJSVWU2t2kQ7HDil9re"
|
|
|
|
echo "📊 Current status of refill-only colors:"
|
|
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "
|
|
SELECT boja, refill, spulna, kolicina
|
|
FROM filaments
|
|
WHERE tip = 'PLA'
|
|
AND finish = 'Basic'
|
|
AND boja IN (
|
|
'Nardo Gray', 'Blue Grey', 'Light Gray', 'Brown', 'Beige',
|
|
'Bronze', 'Purple', 'Cobalt Blue', 'Turquoise', 'Bright Green',
|
|
'Yellow', 'Gold', 'Orange', 'Maroon Red'
|
|
)
|
|
ORDER BY boja;"
|
|
|
|
echo ""
|
|
echo "🔄 Applying fix..."
|
|
|
|
# Apply the migration
|
|
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME < database/migrations/015_fix_refill_only_colors.sql
|
|
|
|
echo ""
|
|
echo "✅ Fix applied! New status:"
|
|
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "
|
|
SELECT boja, refill, spulna, kolicina
|
|
FROM filaments
|
|
WHERE tip = 'PLA'
|
|
AND finish = 'Basic'
|
|
AND boja IN (
|
|
'Nardo Gray', 'Blue Grey', 'Light Gray', 'Brown', 'Beige',
|
|
'Bronze', 'Purple', 'Cobalt Blue', 'Turquoise', 'Bright Green',
|
|
'Yellow', 'Gold', 'Orange', 'Maroon Red'
|
|
)
|
|
ORDER BY boja;"
|
|
|
|
echo ""
|
|
echo "🎉 Refill-only colors have been fixed!" |