-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foreign key constraint failed -- after inserting item into child table and relaunching application #1332
Comments
are you able to setup a git repo with reproduction of this problem, so we can debug your issue? |
This should be fixed in |
@pleerock Yay, this fixed it! Thanks! |
Thank you for the report! |
@pleerock I have the same issue for ManyToMany relations |
@keenondrums He said the issue was actually a bug triggered from using auto generated uuid columns -> |
@lscheeler sorry, I guess I misread it. My issue is a little different then. I'm on 1.0.9 export class EntityId {
@PrimaryGeneratedColumn()
id: number
}
@Entity()
export class Schema extends EntityId {
@Column()
name: string
@Column({ type: 'integer' })
seqNo: number
@OneToMany(
(type) => SchemaField,
(field) => field.schema,
{
cascadeInsert: true,
eager: true
}
)
fields: SchemaField[]
}
@Entity()
export class SchemaField extends EntityId {
@Column()
name: string
@Column({ type: 'integer' })
type: SchemaFieldType
@ManyToMany((type) => Validator)
@JoinTable()
constraints: Validator[]
@ManyToOne(
(type) => Schema,
(schema) => schema.fields
)
schema: Schema
}
@Entity()
export class Validator extends EntityId {
@Column()
name: string
@Column()
validator: string
@Column({
transformer: {
from: (val) => val.split(',').map(parseInt),
to: (val) => val.join(',')
},
type: 'text'
})
fieldTypes: SchemaFieldType[]
}
|
@keenondrums hmm maybe it's from any use of @PrimaryGeneratedColumn() |
does this solved? |
Description
Hi, I am stuck on an issue where I am receiving the error: FOREIGN KEY constraint failed after doing the following steps:
createConnection
with the FOREIGN KEY constraint errorSetup
Parent entity
Child entity
Database connection
Error message
(modified/removed proprietary code)
Questions
Does this have to do with the
synchronize
connection option? If so, I am not sure of how to get around that or the proper way to handle database schema on application re-launch.The text was updated successfully, but these errors were encountered: