diff --git a/scripts/deploy_package.sh b/scripts/deploy_package.sh index 9619365..0b52ff4 100644 --- a/scripts/deploy_package.sh +++ b/scripts/deploy_package.sh @@ -88,9 +88,11 @@ echo "[2/9] Pre-cleaning existing data for this file..." DELETE FROM ${P}tkg_edges WHERE file_uuid = '$UUID'; DELETE FROM ${P}tkg_nodes WHERE file_uuid = '$UUID'; DELETE FROM ${P}identity_bindings WHERE identity_id IN ( - SELECT id FROM ${P}identities WHERE file_uuid = '$UUID' OR name LIKE 'PERSON_${UUID:0:8}%' + SELECT id FROM ${P}identities WHERE file_uuid = '$UUID' OR file_uuid IS NULL OR name LIKE 'PERSON_${UUID:0:8}%' ); DELETE FROM ${P}identities WHERE file_uuid = '$UUID'; + -- Also delete global identities that will be re-imported (TMDB + merged + user_defined) + DELETE FROM ${P}identities WHERE file_uuid IS NULL AND source IN ('tmdb', 'merged', 'user_defined'); DELETE FROM ${P}face_detections WHERE file_uuid = '$UUID'; DELETE FROM ${P}chunk_vectors WHERE uuid = '$UUID'; DELETE FROM ${P}chunk WHERE file_uuid = '$UUID'; @@ -103,8 +105,10 @@ echo "[2/9] Pre-cleaning existing data for this file..." END IF; END \$\$; + -- Ensure content_hash column exists (added in v1.0.0 V4.2) + ALTER TABLE ${P}videos ADD COLUMN IF NOT EXISTS content_hash TEXT; EOSQL -echo " ✅ Cleared existing data for $UUID" +echo " ✅ Cleared existing data for $UUID (migration: content_hash column ensured)" # 3. Import each table file in dependency order (FK constraints) echo "[3/9] Normalizing schema prefix and importing DB data..."