Fossil SCM
An improved method for clearing out unwanted table during rebuild.
Commit
aeec557e897f2afb4734151998d285af80563052256c2b6763fc54d69492d55c
Parent
55f136610030f7e…
1 file changed
+9
-5
+9
-5
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -390,27 +390,31 @@ | ||
| 390 | 390 | } |
| 391 | 391 | manifest_disable_event_triggers(); |
| 392 | 392 | rebuild_update_schema(); |
| 393 | 393 | blob_init(&sql, 0, 0); |
| 394 | 394 | db_unprotect(PROTECT_ALL); |
| 395 | +#ifndef SQLITE_PREPARE_DONT_LOG | |
| 396 | + g.dbIgnoreErrors++; | |
| 397 | +#endif | |
| 395 | 398 | db_prepare(&q, |
| 396 | - "SELECT name FROM sqlite_schema /*scan*/" | |
| 397 | - " WHERE type='table'" | |
| 399 | + "SELECT name FROM pragma_table_list /*scan*/" | |
| 400 | + " WHERE schema='repository' AND type IN ('table','virtual')" | |
| 398 | 401 | " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias'," |
| 399 | 402 | "'config','shun','private','reportfmt'," |
| 400 | 403 | "'concealed','accesslog','modreq'," |
| 401 | 404 | "'purgeevent','purgeitem','unversioned'," |
| 402 | 405 | "'subscriber','pending_alert','chat')" |
| 403 | 406 | " AND name NOT GLOB 'sqlite_*'" |
| 404 | - " AND name NOT GLOB 'fx_*'" | |
| 405 | - " AND name NOT GLOB 'ftsidx_*'" | |
| 406 | - " AND name NOT GLOB 'chatfts1_*'" | |
| 407 | + " AND name NOT GLOB 'fx_*';" | |
| 407 | 408 | ); |
| 408 | 409 | while( db_step(&q)==SQLITE_ROW ){ |
| 409 | 410 | blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0)); |
| 410 | 411 | } |
| 411 | 412 | db_finalize(&q); |
| 413 | +#ifndef SQLITE_PREPARE_DONT_LOG | |
| 414 | + g.dbIgnoreErrors--; | |
| 415 | +#endif | |
| 412 | 416 | db_multi_exec("%s", blob_str(&sql)/*safe-for-%s*/); |
| 413 | 417 | blob_reset(&sql); |
| 414 | 418 | db_multi_exec("%s", zRepositorySchema2/*safe-for-%s*/); |
| 415 | 419 | ticket_create_table(0); |
| 416 | 420 | shun_artifacts(); |
| 417 | 421 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -390,27 +390,31 @@ | |
| 390 | } |
| 391 | manifest_disable_event_triggers(); |
| 392 | rebuild_update_schema(); |
| 393 | blob_init(&sql, 0, 0); |
| 394 | db_unprotect(PROTECT_ALL); |
| 395 | db_prepare(&q, |
| 396 | "SELECT name FROM sqlite_schema /*scan*/" |
| 397 | " WHERE type='table'" |
| 398 | " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias'," |
| 399 | "'config','shun','private','reportfmt'," |
| 400 | "'concealed','accesslog','modreq'," |
| 401 | "'purgeevent','purgeitem','unversioned'," |
| 402 | "'subscriber','pending_alert','chat')" |
| 403 | " AND name NOT GLOB 'sqlite_*'" |
| 404 | " AND name NOT GLOB 'fx_*'" |
| 405 | " AND name NOT GLOB 'ftsidx_*'" |
| 406 | " AND name NOT GLOB 'chatfts1_*'" |
| 407 | ); |
| 408 | while( db_step(&q)==SQLITE_ROW ){ |
| 409 | blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0)); |
| 410 | } |
| 411 | db_finalize(&q); |
| 412 | db_multi_exec("%s", blob_str(&sql)/*safe-for-%s*/); |
| 413 | blob_reset(&sql); |
| 414 | db_multi_exec("%s", zRepositorySchema2/*safe-for-%s*/); |
| 415 | ticket_create_table(0); |
| 416 | shun_artifacts(); |
| 417 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -390,27 +390,31 @@ | |
| 390 | } |
| 391 | manifest_disable_event_triggers(); |
| 392 | rebuild_update_schema(); |
| 393 | blob_init(&sql, 0, 0); |
| 394 | db_unprotect(PROTECT_ALL); |
| 395 | #ifndef SQLITE_PREPARE_DONT_LOG |
| 396 | g.dbIgnoreErrors++; |
| 397 | #endif |
| 398 | db_prepare(&q, |
| 399 | "SELECT name FROM pragma_table_list /*scan*/" |
| 400 | " WHERE schema='repository' AND type IN ('table','virtual')" |
| 401 | " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias'," |
| 402 | "'config','shun','private','reportfmt'," |
| 403 | "'concealed','accesslog','modreq'," |
| 404 | "'purgeevent','purgeitem','unversioned'," |
| 405 | "'subscriber','pending_alert','chat')" |
| 406 | " AND name NOT GLOB 'sqlite_*'" |
| 407 | " AND name NOT GLOB 'fx_*';" |
| 408 | ); |
| 409 | while( db_step(&q)==SQLITE_ROW ){ |
| 410 | blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0)); |
| 411 | } |
| 412 | db_finalize(&q); |
| 413 | #ifndef SQLITE_PREPARE_DONT_LOG |
| 414 | g.dbIgnoreErrors--; |
| 415 | #endif |
| 416 | db_multi_exec("%s", blob_str(&sql)/*safe-for-%s*/); |
| 417 | blob_reset(&sql); |
| 418 | db_multi_exec("%s", zRepositorySchema2/*safe-for-%s*/); |
| 419 | ticket_create_table(0); |
| 420 | shun_artifacts(); |
| 421 |