_snapshot.json data is malformed
Whenever I run npx drizzle-kit pull to get my pre-existing Supabase schema it works. If I then try to run
npx drizzle-kit generate
it says supabase/migrations/meta/20241203225947_snapshot.json data is malformed
I don't know what is causing the issue. I did not edit the 20241203225947_snapshot.json1 Reply
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