Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要向现有表添加唯一字段索引。我做了这一行:
ALTER TABLE auth_user ADD UNIQUE INDEX (email);
表和字段已经存在。错误是:
查询错误:“唯一”附近:语法错误无法执行语句
我错过了什么?它对 SQLite3 有什么特殊要求吗?
CREATE UNIQUE INDEX IF NOT EXISTS MyUniqueIndexName ON auth_user (email)
另外,请阅读官方手册:
http://www.sqlite.org/lang_createindex.html