4.0.3: Исправлен user_id в weekly_goals
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m34s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m34s
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
-- Rollback migration: This migration cannot be automatically rolled back
|
||||
-- The user_id values were corrected from projects.user_id, so reverting would
|
||||
-- require knowing the original incorrect values, which is not possible.
|
||||
-- If rollback is needed, you would need to manually restore from a backup.
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Migration: Fix weekly_goals.user_id by updating it from projects.user_id
|
||||
-- This migration fixes the issue where weekly_goals.user_id was incorrectly set to NULL or wrong user_id
|
||||
-- It updates all weekly_goals records to have the correct user_id from their associated project
|
||||
|
||||
UPDATE weekly_goals wg
|
||||
SET user_id = p.user_id
|
||||
FROM projects p
|
||||
WHERE wg.project_id = p.id
|
||||
AND (wg.user_id IS NULL OR wg.user_id != p.user_id);
|
||||
Reference in New Issue
Block a user