1-- add ip column to comments table 2CREATE TEMPORARY TABLE temp_comments ( 3 cid INTEGER PRIMARY KEY, 4 pid, 5 source, 6 name, 7 mail, 8 web, 9 avatar, 10 created INTEGER, 11 text, 12 status 13); 14INSERT INTO temp_comments 15 SELECT cid, pid, source, name, mail, web, avatar, created, text, status 16 FROM comments 17; 18 19DROP TABLE comments; 20CREATE TABLE comments ( 21 cid INTEGER PRIMARY KEY, 22 pid, 23 source, 24 name, 25 mail, 26 web, 27 avatar, 28 created INTEGER, 29 text, 30 status, 31 ip 32); 33CREATE INDEX idx_comments_created ON comments(created); 34CREATE INDEX idx_comments_pid ON comments(pid); 35CREATE INDEX idx_comments_status ON comments(status); 36 37INSERT INTO comments 38 SELECT cid, pid, source, name, mail, web, avatar, created, text, status, null 39 FROM temp_comments 40; 41DROP TABLE temp_comments; 42 43-- add comments_enabled column to entries table 44CREATE TEMPORARY TABLE temp_entries ( 45 pid PRIMARY KEY, 46 page, 47 title, 48 blog, 49 image, 50 created INTEGER, 51 lastmod INTEGER, 52 author, 53 login, 54 email 55); 56INSERT INTO temp_entries 57 SELECT pid, page, title, blog, image, created, lastmod, author, login, email 58 FROM entries 59; 60 61DROP TABLE entries; 62CREATE TABLE entries ( 63 pid PRIMARY KEY, 64 page, 65 title, 66 blog, 67 image, 68 created INTEGER, 69 lastmod INTEGER, 70 author, 71 login, 72 mail, 73 comments_enabled 74); 75CREATE UNIQUE INDEX idx_entries_pid ON entries(pid); 76CREATE INDEX idx_entries_title ON entries(title); 77CREATE INDEX idx_entries_created ON entries(created); 78CREATE INDEX idx_entries_blog ON entries(blog); 79 80INSERT INTO entries 81 SELECT pid, page, title, blog, image, created, lastmod, author, login, email, 1 82 FROM temp_entries 83; 84DROP TABLE temp_entries; 85