create-prenta 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# create-actuate-cms
|
|
2
2
|
|
|
3
|
+
## 1.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f873399: Migration `0021` renames leftover `actuate_*` tables onto `prenta_*` and keeps their rows. `0012` had renamed those tables' indexes but not the tables themselves, so collaboration data was stranded and `0013` could not finish.
|
|
8
|
+
|
|
3
9
|
## 1.6.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
-- #784: 0012 renames a fixed table list, then renames every actuate_-prefixed
|
|
2
|
+
-- index, constraint, and sequence. Hand-created collaboration tables (#729)
|
|
3
|
+
-- were not in that list, so they stayed actuate_document_* while their
|
|
4
|
+
-- indexes became prenta_*. 0013 then CREATE TABLE prenta_document_* and
|
|
5
|
+
-- collides with those index names, so migrate deploy stops and the rows
|
|
6
|
+
-- never move.
|
|
7
|
+
--
|
|
8
|
+
-- Rename any leftover actuate_* table onto prenta_*. If 0013 already created
|
|
9
|
+
-- an empty twin, drop the twin first so the table that holds the data takes
|
|
10
|
+
-- the canonical name. Refuse when both copies already have rows.
|
|
11
|
+
-- Then repeat 0012's prefix sweep for anything still named actuate_*.
|
|
12
|
+
--
|
|
13
|
+
-- A deploy stuck on 0013 ("already exists") should run this file once, then
|
|
14
|
+
-- re-run `prisma migrate deploy`. After the rename, 0013's
|
|
15
|
+
-- CREATE TABLE IF NOT EXISTS is a no-op and this migration runs again as one.
|
|
16
|
+
|
|
17
|
+
DO $$
|
|
18
|
+
DECLARE
|
|
19
|
+
r RECORD;
|
|
20
|
+
target text;
|
|
21
|
+
twin_rows bigint;
|
|
22
|
+
BEGIN
|
|
23
|
+
FOR r IN
|
|
24
|
+
SELECT tablename
|
|
25
|
+
FROM pg_tables
|
|
26
|
+
WHERE schemaname = 'public' AND tablename LIKE 'actuate\_%'
|
|
27
|
+
ORDER BY tablename
|
|
28
|
+
LOOP
|
|
29
|
+
target := replace(r.tablename, 'actuate_', 'prenta_');
|
|
30
|
+
|
|
31
|
+
IF EXISTS (
|
|
32
|
+
SELECT 1 FROM pg_tables
|
|
33
|
+
WHERE schemaname = 'public' AND tablename = target
|
|
34
|
+
) THEN
|
|
35
|
+
EXECUTE format('SELECT count(*) FROM %I', target) INTO twin_rows;
|
|
36
|
+
IF twin_rows > 0 THEN
|
|
37
|
+
RAISE EXCEPTION
|
|
38
|
+
'refusing to rename % onto %: both tables have rows',
|
|
39
|
+
r.tablename, target;
|
|
40
|
+
END IF;
|
|
41
|
+
EXECUTE format('DROP TABLE %I CASCADE', target);
|
|
42
|
+
END IF;
|
|
43
|
+
|
|
44
|
+
EXECUTE format('ALTER TABLE %I RENAME TO %I', r.tablename, target);
|
|
45
|
+
END LOOP;
|
|
46
|
+
|
|
47
|
+
FOR r IN
|
|
48
|
+
SELECT con.conname, con.conrelid::regclass AS tbl
|
|
49
|
+
FROM pg_constraint con
|
|
50
|
+
JOIN pg_class c ON c.oid = con.conrelid
|
|
51
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
52
|
+
WHERE n.nspname = 'public' AND con.conname LIKE '%actuate\_%'
|
|
53
|
+
LOOP
|
|
54
|
+
EXECUTE format(
|
|
55
|
+
'ALTER TABLE %s RENAME CONSTRAINT %I TO %I',
|
|
56
|
+
r.tbl, r.conname, replace(r.conname, 'actuate_', 'prenta_')
|
|
57
|
+
);
|
|
58
|
+
END LOOP;
|
|
59
|
+
|
|
60
|
+
FOR r IN
|
|
61
|
+
SELECT indexname FROM pg_indexes
|
|
62
|
+
WHERE schemaname = 'public' AND indexname LIKE '%actuate\_%'
|
|
63
|
+
LOOP
|
|
64
|
+
EXECUTE format(
|
|
65
|
+
'ALTER INDEX %I RENAME TO %I',
|
|
66
|
+
r.indexname, replace(r.indexname, 'actuate_', 'prenta_')
|
|
67
|
+
);
|
|
68
|
+
END LOOP;
|
|
69
|
+
|
|
70
|
+
FOR r IN
|
|
71
|
+
SELECT c.relname
|
|
72
|
+
FROM pg_class c
|
|
73
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
74
|
+
WHERE n.nspname = 'public' AND c.relkind = 'S' AND c.relname LIKE '%actuate\_%'
|
|
75
|
+
LOOP
|
|
76
|
+
EXECUTE format(
|
|
77
|
+
'ALTER SEQUENCE %I RENAME TO %I',
|
|
78
|
+
r.relname, replace(r.relname, 'actuate_', 'prenta_')
|
|
79
|
+
);
|
|
80
|
+
END LOOP;
|
|
81
|
+
END $$;
|