tags:

views:

22

answers:

0

What happens to Triggers/Indexes when i rename/drop a table SQLite?

I'm running and upgrade script where i add a column to a table, so i d the following:

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];

The Entry table had a trigger and an index

-- 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]);

Do i have to drop them before the update and create a new one after? Or can i just leave them?