ijohnston
DTDrizzle Team
•Created by ijohnston on 12/4/2024 in #help
_snapshot.json data is malformed
POSSIBLE SOLUTION:
1. Run
npx drizzle-kit pull
- this generates multiple files in a folder called migrations:
-_journals.json
-_snapshot.json
-relations.ts
-schema.ts
2. Place the schema.ts and relations.ts in the appropriate place (for me: src -> db)
3. Temporarily rename the migrations folder from step 1 to something else: "migrationsTemp"
4. Now run npx drizzle-kit generate
5. This will create a new migrations folder.
6. Copy the _snapshot.json file from the new migrations folder and place it in the old migrations folder "migrationsTemp" (technically copy/paste the file content, not the file)
7. Delete the new migrations folder; rename migrationsTemp to migrations
8. I was then able to edit the schema.ts to add any new tables and then run npx drizzle-kit generate
along with npx drizzle-kit migrate
2 replies
DTDrizzle Team
•Created by ijohnston on 11/21/2024 in #help
Supabase [users.id]
@rphlmr ⚡ Thanks. That fixed the schema.ts file. Another question
The github example repo does not contain a relations.ts file.
In my project the relations.ts contains this:
import { usersInAuth, notifications, notificationChannels, notificationTypeNotificationChannel, notificationTypes, userNotificationPreferences, schoolNotificationInstructions, schools, usersExt, subsTeacherRequests, roles, joinCodes, schoolUserRoles, scheduledNotifications, invites, organizationSettings } from "./schema";
The usersInAuth
has this error: Module '"./schema"' has no exported member 'usersInAuth'.ts(2305)
Two Options To Fix. Which is correct, or is there a better option? I have had a terribly hard time getting the pull and then generate to work
1. I import the predefined members like i did in the schema.ts file to the relations.ts:
2. I create another authSchema file that defines usersInAuth as detailed here and import that: https://www.reddit.com/r/Supabase/comments/1d8yse0/comment/l7c64km/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button5 replies