当我重命名/删除表SQLite时,触发器/索引会发生什么?
我正在运行并升级脚本,我在表中添加了一列,所以我得到以下内容:
ALTER TABLE [Entry] RENAME TO [Entry_temp];
CREATE TABLE [Entry] (
[EntryID] integer PRIMARY KEY AUTOINCREMENT NOT NULL,
...
)
INSERT INTO [Entry]
(...)
SELECT ...
FROM [Entry_temp];
DROP TABLE [Entry_temp];
Entry表有一个触发器和一个索引
-- these were created before
CREATE TRIGGER Entry_Version_Update AFTER UPDATE ON [Entry]
BEGIN
UPDATE [Entry] SET [Version] = [Version] + 1
WHERE [EntryID] = new.[EntryID];
END;
CREATE INDEX ix_Entry_ClientID ON [Entry] ([ClientID]);
我必须在更新之前删除它们并在之后创建一个新的吗?或者我可以离开他们?