| 268 | #else |
| 269 | /* |
| 270 | * SQLite < 3.2.0 doesn't support ALTER TABLE ADD COLUMN |
| 271 | * Unfortunately, Tiger ships with SQLite < 3.2.0 (#34463) |
| 272 | * This is taken from http://www.sqlite.org/faq.html#q11 |
| 273 | */ |
| 274 | |
| 275 | /* Create a temporary table */ |
| 276 | "CREATE TEMPORARY TABLE mp_files_backup (id INTEGER, path TEXT, " |
| 277 | "actual_path TEXT, active INT, mtime DATETIME, md5sum TEXT, editable INT, " |
| 278 | "FOREIGN KEY(id) REFERENCES ports(id))", |
| 279 | |
| 280 | /* Copy all data into the temporary table */ |
| 281 | "INSERT INTO mp_files_backup SELECT id, path, actual_path, active, mtime, " |
| 282 | "md5sum, editable FROM registry.files", |
| 283 | |
| 284 | /* Drop the original table and re-create it with the new structure */ |
| 285 | "DROP TABLE registry.files", |
| 286 | "CREATE TABLE registry.files (id INTEGER, path TEXT, actual_path TEXT, " |
| 287 | "active INT, mtime DATETIME, md5sum TEXT, editable INT, binary BOOL, " |
| 288 | "FOREIGN KEY(id) REFERENCES ports(id))", |
| 289 | "CREATE INDEX registry.file_port ON files(id)", |
| 290 | "CREATE INDEX registry.file_path ON files(path)", |
| 291 | "CREATE INDEX registry.file_actual ON files(actual_path)", |
| 292 | |
| 293 | /* Copy all data back from temporary table */ |
| 294 | "INSERT INTO registry.files (id, path, actual_path, active, mtime, md5sum, " |
| 295 | "editable) SELECT id, path, actual_path, active, mtime, md5sum, " |
| 296 | "editable FROM mp_files_backup", |
| 297 | |
| 298 | /* Remove temporary table */ |
| 299 | "DROP TABLE mp_files_backup", |
| 300 | #endif |