Dhravya / cloudflare-saas-stack

Quickly make and deploy full-stack apps with database, auth, styling, storage etc. figured out for you. Add all primitives you want.
3.07k stars 231 forks source link

No Migration found - Error on first run #45

Closed ravisojitra closed 1 month ago

ravisojitra commented 1 month ago

After hitting bun run setup

Query: select count(*) from "user" ⨯ Error: D1_ERROR: no such table: user: SQLITE_ERROR at async Page (./src/app/page.tsx:29:23) digest: "4057397386" Cause: Error: no such table: user: SQLITE_ERROR at D1Database._sendOrThrow (cloudflare-internal:d1-api:67:24) at async D1PreparedStatement.raw (cloudflare-internal:d1-api:184:32) {

patriciobcs commented 1 month ago

I fixed it by replacing some lines in the setup script:

https://github.com/Dhravya/cloudflare-saas-stack/blob/836b4c2b3daab6fad2e3281c354fac681cbe6dd2/scripts/setup.ts#L324

Change to

executeCommand(`bunx wrangler d1 execute ${dbName} --local --file=./drizzle/0000_setup.sql`);

https://github.com/Dhravya/cloudflare-saas-stack/blob/836b4c2b3daab6fad2e3281c354fac681cbe6dd2/scripts/setup.ts#L329

Change to

executeCommand(`bunx wrangler d1 execute ${dbName} --remote --file=./drizzle/0000_setup.sql`);

ravisojitra commented 1 month ago

Thanks @patriciobcs, It worked.