No matter what i change in my schema, i get errors. Only if i drop all tables. i can successfully push again. Even just simple changes to schema doesn't work.
Here is an example of an error i get:
terminal
terminal
@repo/db:db:push: TypeError: Cannot read properties of undefined (reading 'primaryKey')@repo/db:db:push: at logSuggestionsAndReturn2 (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:72915:87)@repo/db:db:push: at sqlitePush (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:74866:19)@repo/db:db:push: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)@repo/db:db:push: at async Object.handler (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:83724:9)@repo/db:db:push: at async run (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:82064:7)
@repo/db:db:push: TypeError: Cannot read properties of undefined (reading 'primaryKey')@repo/db:db:push: at logSuggestionsAndReturn2 (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:72915:87)@repo/db:db:push: at sqlitePush (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:74866:19)@repo/db:db:push: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)@repo/db:db:push: at async Object.handler (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:83724:9)@repo/db:db:push: at async run (/Users/gaden/Documents/GitHub/flashcards/node_modules/drizzle-kit/bin.cjs:82064:7)
import { createClient, type Client } from "@libsql/client";import { drizzle } from "drizzle-orm/libsql";import { config } from "dotenv";import { env } from "@repo/env";import * as schema from "./schema";config({ path: ".env" });/** * Cache the database connection in development. This avoids creating a new connection on every HMR * update. */const globalForDb = globalThis as unknown as { client: Client | undefined;};export const client = globalForDb.client ?? createClient({ url: process.env.TURSO_CONNECTION_URL!, authToken: process.env.TURSO_AUTH_TOKEN!, });if (env.NODE_ENV !== "production") globalForDb.client = client;export const db = drizzle(client, { schema });
import { createClient, type Client } from "@libsql/client";import { drizzle } from "drizzle-orm/libsql";import { config } from "dotenv";import { env } from "@repo/env";import * as schema from "./schema";config({ path: ".env" });/** * Cache the database connection in development. This avoids creating a new connection on every HMR * update. */const globalForDb = globalThis as unknown as { client: Client | undefined;};export const client = globalForDb.client ?? createClient({ url: process.env.TURSO_CONNECTION_URL!, authToken: process.env.TURSO_AUTH_TOKEN!, });if (env.NODE_ENV !== "production") globalForDb.client = client;export const db = drizzle(client, { schema });