ForeignKeyViolation
public struct ForeignKeyViolation : FetchableRecord, CustomStringConvertible
A foreign key violation produced by PRAGMA foreign_key_check
See https://www.sqlite.org/pragma.html#pragma_foreign_key_check
-
The name of the table that contains the
REFERENCESclauseDeclaration
Swift
public var originTable: String -
The rowid of the row that contains the invalid
REFERENCESclause, or nil if the origin table is aWITHOUT ROWIDtable.Declaration
Swift
public var originRowID: Int64? -
The name of the table that is referred to.
Declaration
Swift
public var destinationTable: String -
The id of the specific foreign key constraint that failed. This id matches
ForeignKeyInfo.id. SeeDatabase.foreignKeys(on:)for more information.Declaration
Swift
public var foreignKeyId: Int -
Declaration
Swift
public init(row: Row) -
Declaration
Swift
public var description: String { get } -
Returns a precise description of the foreign key violation.
For example: ‘FOREIGN KEY constraint violation - from player(teamId) to team(id), in [id:1 teamId:2 name:“O'Brien” score: 1000]’
Declaration
Swift
public func failureDescription(_ db: Database) throws -> String -
Returns a DatabaseError of extended code
SQLITE_CONSTRAINT_FOREIGNKEYDeclaration
Swift
public func databaseError(_ db: Database) -> DatabaseError
View on GitHub
Install in Dash
ForeignKeyViolation Structure Reference