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