如何在sqlite ios中向现有表添加唯一约束? [英] How to add unique constraint to existing table in sqlite ios?
问题描述
我已经通过sqlite数据库浏览器创建了一个数据库和表.我想让用户从Facebook添加选定的朋友名称,但只能添加一次.我如何在sqlite中添加约束?
I have made a database and table already through the sqlite database browser. I want let users add selected friends names from facebook but only once. How di I add constraints in sqlite ?
我检查了sqlite数据库浏览器,但是没有什么可以更改的.
I checked the sqlite database browser but there is nothing there to change it.
我尝试过使用lita,但是在lita中有使其不为null和唯一的选项,但是我无法单击该复选框.
I tried lita for it but in there is option in lita to make it non null and unique but I cant click that checkbox.
推荐答案
我假设您使用的是FireFox的SQLiteManager,请重新创建表,通常在创建表后不允许更改约束
I am assuming you are using SQLiteManager from FireFox, please create the table again, normally it doesn't allow to change the constraints when you have already created a table.
注意-也可以使用代码来完成,这是另一种方式.
NOTE - It can be done using code too, this is another way of doing it..
已编辑见下图
这篇关于如何在sqlite ios中向现有表添加唯一约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!