up
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
-- +goose Up
|
||||
UPDATE game_screen_plans
|
||||
SET steps = (
|
||||
SELECT jsonb_agg(
|
||||
CASE WHEN step->>'mode' IN ('3', '5') THEN
|
||||
step || jsonb_build_object(
|
||||
'mode', 8,
|
||||
'text', CASE step->>'mode'
|
||||
WHEN '3' THEN 'Успехов'
|
||||
ELSE 'Спасибо за игру!'
|
||||
END
|
||||
)
|
||||
ELSE step END
|
||||
ORDER BY position
|
||||
)
|
||||
FROM jsonb_array_elements(steps) WITH ORDINALITY AS items(step, position)
|
||||
), updated_at = NOW()
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM jsonb_array_elements(steps) AS step
|
||||
WHERE step->>'mode' IN ('3', '5')
|
||||
);
|
||||
|
||||
UPDATE screen_sessions
|
||||
SET text = CASE mode WHEN 3 THEN 'Успехов' ELSE 'Спасибо за игру!' END,
|
||||
mode = 8,
|
||||
command = 0,
|
||||
state_version = state_version + 1,
|
||||
updated_at = NOW()
|
||||
WHERE mode IN (3, 5);
|
||||
|
||||
-- +goose Down
|
||||
-- Text screens remain valid in the previous version; original modes cannot be recovered.
|
||||
Reference in New Issue
Block a user