You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/migrate-data.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ This guide covers migrating data from Convex to PostgreSQL (Neon DB).
7
7
## Prerequisites
8
8
9
9
1.**Export Convex Data**
10
+
10
11
- Use Convex dashboard or CLI to export all tables
11
12
- Export format: JSON or CSV
12
13
- Tables to export:
@@ -31,15 +32,18 @@ This guide covers migrating data from Convex to PostgreSQL (Neon DB).
31
32
Create a transformation script that:
32
33
33
34
1.**Convert Convex IDs to UUIDs**
35
+
34
36
- Generate new UUIDs for each record
35
37
- Maintain mapping for foreign key relationships
36
38
37
39
2.**Transform Timestamps**
40
+
38
41
- Convex: milliseconds (number)
39
42
- PostgreSQL: `timestamp with time zone` (Date object)
40
43
- Convert: `new Date(timestamp)` for milliseconds
41
44
42
45
3.**Transform Arrays**
46
+
43
47
- Convex: stored as arrays
44
48
- PostgreSQL: array columns (already compatible)
45
49
- Ensure proper formatting
@@ -101,17 +105,19 @@ WHERE u.id IS NULL;
101
105
### Step 4: Post-Migration Tasks
102
106
103
107
1.**Set up indexes** (if not created by Drizzle):
108
+
104
109
```sql
105
110
-- GIN indexes for array columns
106
-
CREATEINDEXIF NOT EXISTS feed_entries_library_ids_gin_idx
111
+
CREATEINDEXIF NOT EXISTS feed_entries_library_ids_gin_idx
107
112
ON feed_entries USING GIN (library_ids);
108
-
CREATEINDEXIF NOT EXISTS feed_entries_tags_gin_idx
113
+
CREATEINDEXIF NOT EXISTS feed_entries_tags_gin_idx
109
114
ON feed_entries USING GIN (tags);
110
-
115
+
111
116
-- Full-text search (see drizzle/migrations/README.md)
112
117
```
113
118
114
119
2.**Verify functionality**:
120
+
115
121
- Test authentication flow
116
122
- Test feed queries
117
123
- Test admin interfaces
@@ -138,4 +144,3 @@ If migration fails:
138
144
-**entryId field**: The `feed_entries` table uses `entryId` (string) as the unique identifier, not `id` (UUID). Make sure to map Convex feed entry IDs to `entryId` field.
139
145
-**Metadata**: JSONB fields should be preserved as-is from Convex
140
146
-**Capabilities**: Array fields should be preserved as arrays
0 commit comments