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.
我想更改现有表的定义以包含唯一列和ON CONFLICT REPLACE语句。我知道在运行时添加唯一约束的方法如下,但我不知道如何添加或更改冲突解决子句。任何帮助表示赞赏!
ON CONFLICT REPLACE
CREATE UNIQUE INDEX IF NOT EXISTS someIndexName ON someTable(someColumn)
在 SQLite 中,索引没有冲突解决子句。
ALTER TABLE 语句不支持向现有列添加约束。
您必须使用约束重新创建表(或数据库)。