Files
wekan/docs/Databases/Migrations/verify-migrations.sh
T
Lauri Ojansivu ffecc49c92 Docs: WeKan lists are board-wide, not per-swimlane (reflect the #6521 revert).
The per-swimlane-lists model was reverted (its migrations were removed in #6521);
lists are board-wide and the same lists appear in every swimlane. Update the docs
to say so:

  * Features/Lists/Lists.md and Features/Board/Swimlanes.md now state plainly that
    lists are shared across swimlanes (a card belongs to one list and one
    swimlane), and that per-swimlane lists were an experiment that was reverted.
  * The docs/Databases/Migrations/ writeups (MIGRATION_SYSTEM_IMPROVEMENTS,
    MIGRATION_SYSTEM_REVIEW_COMPLETE, CODE_CHANGES_SUMMARY, SESSION_SUMMARY,
    verify-migrations.sh) describe the old cron-driven migration system and the
    per-swimlane-lists migration, both removed; each now carries an OBSOLETE banner
    pointing at the current board-wide model and the live repair paths
    (merge-per-swimlane-lists + repairBoardData).

The dated PerUserDataAudit2025-12-23 snapshot is left as-is: it already observed
that lists are board-wide, and it is a point-in-time record.

Thanks to xet7 !
2026-07-24 16:44:56 +03:00

146 lines
4.6 KiB
Bash

#!/bin/bash
# OBSOLETE (historical): verifies the old cron-driven migration system and the
# per-swimlane-lists migration, both removed. The cron migration subsystem was
# deleted and the per-swimlane-lists board migrations were removed in wekan#6521.
# WeKan lists are board-wide (the same lists appear in every swimlane); there is
# no per-swimlane lists model. Kept only as a record of the former system.
# Verification script for WeKan migration system improvements
# This script checks that all 13 migrations have proper implementations
echo "=========================================="
echo "WeKan Migration System Verification Report"
echo "=========================================="
echo ""
FILE="server/cronMigrationManager.js"
# Check 1: Default case changed to false
echo "✓ Check 1: Default case in isMigrationNeeded() should return false"
if grep -q "default:" "$FILE" && grep -A 1 "default:" "$FILE" | grep -q "return false"; then
echo " PASS: Default case returns false"
else
echo " FAIL: Default case may not return false"
fi
echo ""
# Check 2: All 13 migrations have case statements
MIGRATIONS=(
"lowercase-board-permission"
"change-attachments-type-for-non-images"
"card-covers"
"use-css-class-for-boards-colors"
"denormalize-star-number-per-board"
"add-member-isactive-field"
"ensure-valid-swimlane-ids"
"add-swimlanes"
"add-checklist-items"
"add-card-types"
"migrate-attachments-collectionFS-to-ostrioFiles"
"migrate-avatars-collectionFS-to-ostrioFiles"
"migrate-lists-to-per-swimlane"
)
echo "✓ Check 2: All 13 migrations have isMigrationNeeded() checks"
missing=0
for migration in "${MIGRATIONS[@]}"; do
if grep -q "'$migration'" "$FILE"; then
echo " ✓ $migration"
else
echo " ✗ $migration - MISSING"
((missing++))
fi
done
if [ $missing -eq 0 ]; then
echo " PASS: All 13 migrations have checks"
else
echo " FAIL: $missing migrations are missing"
fi
echo ""
# Check 3: All migrations have execute handlers
echo "✓ Check 3: All migrations have execute() handlers"
execute_methods=(
"executeDenormalizeStarCount"
"executeEnsureValidSwimlaneIds"
"executeLowercasePermission"
"executeComprehensiveBoardMigration"
"executeAttachmentTypeStandardization"
"executeCardCoversMigration"
"executeMemberActivityMigration"
"executeAddSwimlanesIdMigration"
"executeAddCardTypesMigration"
"executeAttachmentMigration"
"executeAvatarMigration"
"executeBoardColorMigration"
"executeChecklistItemsMigration"
)
missing_methods=0
for method in "${execute_methods[@]}"; do
if grep -q "async $method" "$FILE"; then
echo " ✓ $method()"
else
echo " ✗ $method() - MISSING"
((missing_methods++))
fi
done
if [ $missing_methods -eq 0 ]; then
echo " PASS: All execute methods exist"
else
echo " FAIL: $missing_methods execute methods are missing"
fi
echo ""
# Check 4: Checklists model is imported
echo "✓ Check 4: Checklists model is imported"
if grep -q "import Checklists from" "$FILE"; then
echo " PASS: Checklists imported"
else
echo " FAIL: Checklists not imported"
fi
echo ""
# Check 5: No simulated execution for unknown migrations
echo "✓ Check 5: No simulated execution (removed fallback)"
if ! grep -q "Simulate step execution with progress updates for other migrations" "$FILE"; then
echo " PASS: Simulated execution removed"
else
echo " WARN: Old simulation code may still exist"
fi
echo ""
# Check 6: Real implementations (sample check)
echo "✓ Check 6: Sample real implementations (checking for database queries)"
implementations=0
if grep -q "Boards.find({" "$FILE"; then
((implementations++))
echo " ✓ Real Boards.find() queries found"
fi
if grep -q "Cards.find({" "$FILE"; then
((implementations++))
echo " ✓ Real Cards.find() queries found"
fi
if grep -q "Users.find({" "$FILE"; then
((implementations++))
echo " ✓ Real Users.find() queries found"
fi
if grep -q "Checklists.find({" "$FILE"; then
((implementations++))
echo " ✓ Real Checklists.find() queries found"
fi
echo " PASS: $implementations real database implementations found"
echo ""
echo "=========================================="
echo "Summary: All migration improvements applied!"
echo "=========================================="
echo ""
echo "Next steps:"
echo "1. Test with fresh WeKan installation"
echo "2. Verify no migrations run (all marked 'not needed')"
echo "3. Test with old database with legacy data"
echo "4. Verify migrations detect and run with real progress"
echo ""