Altering Foreign Key doesn't create Constraint #1461
Unanswered
guilhermemiua
asked this question in
Help
Replies: 1 comment 3 replies
-
Please format the code blocks. https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm facing a problem to alter some Foreign Keys in my Project.
I drop the Foreign Key then I alter the column. When I rollback the migrations appears an error saying that "constraint does not exist". Here it is my Migration File.
`'use strict'
/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
class AlterDocSchema extends Schema {
up () {
this.alter('doc', async (table) => {
await table.dropForeign('status_group_id')
}
down () {
this.alter('doc', async (table) => {
await table.dropForeign('status_group_id')
}
}
module.exports = AlterDocSchema
`
What's the correct way to alter a foreign key column?
Beta Was this translation helpful? Give feedback.
All reactions