[英]Unable to set foreign key SQLite.swift
I am not able to set foreign key using stephencelis SQLite.swift. 我无法使用stephencelis SQLite.swift设置外键。
t.foreignKey(user_id, references:"user_mstr",user_id)
I have two tables user_master
and user_details
. 我有两个表
user_master
和user_details
。 How to set user_id
as a foreign key in user_detail
table. 如何在
user_detail
表中将user_id
设置为外键。 I am getting below error. 我正在错误以下。
Cannot invoke foreignkey with an arguement list of type (Expression<string>),
You're passing string to references. 您正在将字符串传递给引用。 It should be like
应该像
let user_id = Expression<String>("user_id")
let user_mstr = Table("user_mstr")
//cate t somehow
t.foreignKey(user_id, references: user_mstr, user_id)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.