mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
fix(db): preserve distinct named envs in migration
This commit is contained in:
1 parent
ee7a3a58a5
commit
eea8da12aa
1 file changed
+5
-2
@@ -11,17 +11,20 @@ BEGIN
|
||||
SELECT
|
||||
e.id,
|
||||
CASE
|
||||
-- Only collapse classes that are globally singleton by design.
|
||||
-- Named remote environments may legitimately differ across companies
|
||||
-- even when they share the same display name.
|
||||
WHEN e.driver = 'local' THEN '__paperclip_builtin_local__'
|
||||
WHEN e.driver = 'sandbox' AND (e.metadata ->> 'managedByPaperclip')::boolean = true
|
||||
THEN '__paperclip_managed_sandbox__'
|
||||
ELSE e.driver || ':' || e.name
|
||||
ELSE e.id::text
|
||||
END AS group_key,
|
||||
row_number() OVER (
|
||||
PARTITION BY CASE
|
||||
WHEN e.driver = 'local' THEN '__paperclip_builtin_local__'
|
||||
WHEN e.driver = 'sandbox' AND (e.metadata ->> 'managedByPaperclip')::boolean = true
|
||||
THEN '__paperclip_managed_sandbox__'
|
||||
ELSE e.driver || ':' || e.name
|
||||
ELSE e.id::text
|
||||
END
|
||||
ORDER BY e.created_at ASC, e.id ASC
|
||||
) AS rn
|
||||
|
||||
Reference in new issue
Block a user