| | @@ -903,25 +903,33 @@ |
| 903 | 903 | || strcmp(zDb,"configdb")==0 |
| 904 | 904 | || strcmp(zDb,"repository")==0 ); |
| 905 | 905 | if( strcmp(zDb, g.zMainDbType)==0 ) zDb = "main"; |
| 906 | 906 | return zDb; |
| 907 | 907 | } |
| 908 | + |
| 909 | +/* |
| 910 | +** Return TRUE if the schema is out-of-date |
| 911 | +*/ |
| 912 | +int db_schema_is_outofdate(void){ |
| 913 | + return db_exists("SELECT 1 FROM config" |
| 914 | + " WHERE name='aux-schema'" |
| 915 | + " AND value<>'%s'", AUX_SCHEMA); |
| 916 | +} |
| 908 | 917 | |
| 909 | 918 | /* |
| 910 | 919 | ** Verify that the repository schema is correct. If it is not correct, |
| 911 | 920 | ** issue a fatal error and die. |
| 912 | 921 | */ |
| 913 | 922 | void db_verify_schema(void){ |
| 914 | | - if( db_exists("SELECT 1 FROM config" |
| 915 | | - " WHERE name='aux-schema'" |
| 916 | | - " AND value<>'%s'", AUX_SCHEMA) ){ |
| 923 | + if( db_schema_is_outofdate() ){ |
| 917 | 924 | fossil_warning("incorrect repository schema version"); |
| 918 | 925 | fossil_warning("you have version \"%s\" but you need version \"%s\"", |
| 919 | 926 | db_get("aux-schema",0), AUX_SCHEMA); |
| 920 | 927 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 921 | 928 | } |
| 922 | 929 | } |
| 930 | + |
| 923 | 931 | |
| 924 | 932 | /* |
| 925 | 933 | ** COMMAND: test-move-repository |
| 926 | 934 | ** |
| 927 | 935 | ** Usage: %fossil test-move-repository PATHNAME |
| 928 | 936 | |