Hey, there a way to update an existing migration/table?

Hey all, I'm trying to add a new field to an existing table, but I don't know how can I do that. I can't add the new field in the existing migration 'cause when I run again I'm getting the error something like "Table exists...". So the think what I'm trying to do is something like "[timestamp]_update_users_table.ts" and add the new fields!
Solution:
Forget it, stupid question, I have discovered
alterTable
alterTable
in the schema module 😊 you can do this
await db.schema.alterTable('users').addColumn('...')
await db.schema.alterTable('users').addColumn('...')
...
Jump to solution
4 Replies
Igal
Igal16mo ago
Hey 👋 In SQL, to add a column to a table, you'd need to run an ALTER TABLE query.
Solution
Josué Ayala
Josué Ayala16mo ago
Forget it, stupid question, I have discovered
alterTable
alterTable
in the schema module 😊 you can do this
await db.schema.alterTable('users').addColumn('...')
await db.schema.alterTable('users').addColumn('...')
Josué Ayala
Josué Ayala16mo ago
Yup! thanks @Igal
Igal
Igal16mo ago
There are no stupid questions
Want results from more Discord servers?
Add your server