webdevcody / next-drizzle-lucia-sqlite-template

MIT License
365 stars 95 forks source link

Add missing db/migrate.ts script #12

Closed delasy closed 3 months ago

delasy commented 3 months ago

I copied template from https://orm.drizzle.team/docs/migrations and modified to work with SQLite adapter that we have. If you run the npm run db:migrate you will get a missing journal error. And this is due to the lack of actual migrations. You need to run npm run db:generate first.

I didn't run it and didn't include migrations into the template because user might want to change tables prefix. If tables prefix changes then user will have to regenerate all migrations.

Generally speaking I would change README.md to use migrations approach instead of db:push. It's anti-pattern to db:push directly into production database. You never know how does the final push migration looks like.