fix: remove if/else from sexy/import/all to avoid arty syntax error

Removed interactive confirmation prompt (read -p and if/else/fi) from
sexy/import/all script. The if/else control structure caused syntax errors
when executed via arty due to how arty appends "$@" to scripts.

The script now runs directly without confirmation. Users should be careful
when running this destructive operation as it will immediately:
1. Drop and recreate all database tables
2. Apply Directus schema snapshot
3. Restart the Directus API

Warning message is still displayed before execution.
This commit is contained in:
2025-10-28 23:24:36 +01:00
parent dee16f7321
commit 129a759795

View File

@@ -133,21 +133,16 @@ scripts:
# Step 2: Apply schema (updates Directus metadata) # Step 2: Apply schema (updates Directus metadata)
sexy/import/all: | sexy/import/all: |
echo "⚠️ WARNING: This will completely replace the database and schema!" && echo "⚠️ WARNING: This will completely replace the database and schema!" &&
read -p "Are you sure? Type 'yes' to continue: " confirm && echo "Importing database..." &&
if [ "$confirm" = "yes" ]; then docker exec -i core_postgres psql -U ${DB_USER} -d ${SEXY_DB_NAME} < ~/Projects/docker-compose/sexy/directus.sql &&
echo "Importing database..." && echo "✓ Database imported" &&
docker exec -i core_postgres psql -U ${DB_USER} -d ${SEXY_DB_NAME} < ~/Projects/docker-compose/sexy/directus.sql && echo "Applying Directus schema..." &&
echo "✓ Database imported" && docker cp ~/Projects/docker-compose/sexy/schema.yaml sexy_api:/directus/schema.yaml &&
echo "Applying Directus schema..." && docker exec sexy_api npx directus schema apply --yes /directus/schema.yaml &&
docker cp ~/Projects/docker-compose/sexy/schema.yaml sexy_api:/directus/schema.yaml && echo "✓ Schema applied" &&
docker exec sexy_api npx directus schema apply --yes /directus/schema.yaml && echo "Restarting Directus API..." &&
echo "✓ Schema applied" && docker restart sexy_api &&
echo "Restarting Directus API..." && echo "✓✓✓ Complete import finished successfully!"
docker restart sexy_api &&
echo "✓✓✓ Complete import finished successfully!";
else
echo "Import cancelled.";
fi
sexy/uploads/export: | sexy/uploads/export: |
rm -rf sexy/uploads rm -rf sexy/uploads