How to handle adding new columns to schema?

I have a schema, but I've decided I need to add a new column. I change the schema.ts file, push, and get the error
LibsqlError: SQLITE_UNKNOWN: SQLite error: table work_experience has 7 columns but 6 values were supplied
at mapHranaError (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:48352:12)
at HranaClient.execute (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:48392:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async TursoSqlite.run (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:42848:9)
at async Command.<anonymous> (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:53386:9) {
code: 'SQLITE_UNKNOWN',
[cause]: [ResponseError: SQLite error: table work_experience has 7 columns but 6 values were supplied] {
code: 'SQLITE_UNKNOWN',
proto: {
message: 'SQLite error: table work_experience has 7 columns but 6 values were supplied',
code: 'SQLITE_UNKNOWN'
}
}
}
LibsqlError: SQLITE_UNKNOWN: SQLite error: table work_experience has 7 columns but 6 values were supplied
at mapHranaError (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:48352:12)
at HranaClient.execute (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:48392:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async TursoSqlite.run (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:42848:9)
at async Command.<anonymous> (/Users/steves/repos/side-projects/resume-builder-2/node_modules/drizzle-kit/index.cjs:53386:9) {
code: 'SQLITE_UNKNOWN',
[cause]: [ResponseError: SQLite error: table work_experience has 7 columns but 6 values were supplied] {
code: 'SQLITE_UNKNOWN',
proto: {
message: 'SQLite error: table work_experience has 7 columns but 6 values were supplied',
code: 'SQLITE_UNKNOWN'
}
}
}
I can solve this by dropping the table and then re-running the push, but I'm wondering if there is a better way to go about it,
1 Reply
Andrii Sherman
Andrii Sherman17mo ago
If you are using db push - then not for now db push was designed for a local developemnt, when for such cases you are fine with deleting table and recreating them
Want results from more Discord servers?
Add your server