Fossil SCM
Rig the aux-schema checking so that it accepts a range of schema values. Add the BASEID field to the PLINK table, but continue to allow older versions of the PLINK table so that "rebuild" is not require. The schema will automatically update on the next "rebuild".
Commit
5dd8b2dabead37a4c5f18fa2aa188fbbd48f2a18
Parent
21b30fc023f2b32…
8 files changed
+1
-1
+8
-8
+8
-8
+2
-1
+2
-1
+22
-2
+1
-1
+3
-1
+1
-1
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -164,11 +164,11 @@ | ||
| 164 | 164 | db_begin_transaction(); |
| 165 | 165 | db_record_repository_filename(g.argv[3]); |
| 166 | 166 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 167 | 167 | user_select(); |
| 168 | 168 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 169 | - db_set("aux-schema", AUX_SCHEMA, 0); | |
| 169 | + db_set("aux-schema", AUX_SCHEMA_MAX, 0); | |
| 170 | 170 | db_set("rebuilt", get_version(), 0); |
| 171 | 171 | remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]); |
| 172 | 172 | url_remember(); |
| 173 | 173 | if( g.zSSLIdentity!=0 ){ |
| 174 | 174 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 175 | 175 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -164,11 +164,11 @@ | |
| 164 | db_begin_transaction(); |
| 165 | db_record_repository_filename(g.argv[3]); |
| 166 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 167 | user_select(); |
| 168 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 169 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 170 | db_set("rebuilt", get_version(), 0); |
| 171 | remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]); |
| 172 | url_remember(); |
| 173 | if( g.zSSLIdentity!=0 ){ |
| 174 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 175 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -164,11 +164,11 @@ | |
| 164 | db_begin_transaction(); |
| 165 | db_record_repository_filename(g.argv[3]); |
| 166 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 167 | user_select(); |
| 168 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 169 | db_set("aux-schema", AUX_SCHEMA_MAX, 0); |
| 170 | db_set("rebuilt", get_version(), 0); |
| 171 | remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]); |
| 172 | url_remember(); |
| 173 | if( g.zSSLIdentity!=0 ){ |
| 174 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 175 |
M
src/db.c
+8
-8
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1118,13 +1118,13 @@ | ||
| 1118 | 1118 | |
| 1119 | 1119 | /* |
| 1120 | 1120 | ** Return TRUE if the schema is out-of-date |
| 1121 | 1121 | */ |
| 1122 | 1122 | int db_schema_is_outofdate(void){ |
| 1123 | - return db_exists("SELECT 1 FROM config" | |
| 1124 | - " WHERE name='aux-schema'" | |
| 1125 | - " AND value<>%Q", AUX_SCHEMA); | |
| 1123 | + if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema",""); | |
| 1124 | + return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0 | |
| 1125 | + || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0; | |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | /* |
| 1129 | 1129 | ** Return true if the database is writeable |
| 1130 | 1130 | */ |
| @@ -1139,14 +1139,14 @@ | ||
| 1139 | 1139 | void db_verify_schema(void){ |
| 1140 | 1140 | if( db_schema_is_outofdate() ){ |
| 1141 | 1141 | #ifdef FOSSIL_ENABLE_JSON |
| 1142 | 1142 | g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD; |
| 1143 | 1143 | #endif |
| 1144 | - fossil_warning("incorrect repository schema version"); | |
| 1145 | - fossil_warning("your repository has schema version \"%s\" " | |
| 1146 | - "but this binary expects version \"%s\"", | |
| 1147 | - db_get("aux-schema",0), AUX_SCHEMA); | |
| 1144 | + fossil_warning("incorrect repository schema version: " | |
| 1145 | + "current repository schema version is \"%s\" " | |
| 1146 | + "but need versions between \"%s\" and \"%s\".", | |
| 1147 | + g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX); | |
| 1148 | 1148 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | |
| @@ -1394,11 +1394,11 @@ | ||
| 1394 | 1394 | char *zDate; |
| 1395 | 1395 | Blob hash; |
| 1396 | 1396 | Blob manifest; |
| 1397 | 1397 | |
| 1398 | 1398 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1399 | - db_set("aux-schema", AUX_SCHEMA, 0); | |
| 1399 | + db_set("aux-schema", AUX_SCHEMA_MAX, 0); | |
| 1400 | 1400 | db_set("rebuilt", get_version(), 0); |
| 1401 | 1401 | if( makeServerCodes ){ |
| 1402 | 1402 | db_setup_server_and_project_codes(0); |
| 1403 | 1403 | } |
| 1404 | 1404 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1405 | 1405 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1118,13 +1118,13 @@ | |
| 1118 | |
| 1119 | /* |
| 1120 | ** Return TRUE if the schema is out-of-date |
| 1121 | */ |
| 1122 | int db_schema_is_outofdate(void){ |
| 1123 | return db_exists("SELECT 1 FROM config" |
| 1124 | " WHERE name='aux-schema'" |
| 1125 | " AND value<>%Q", AUX_SCHEMA); |
| 1126 | } |
| 1127 | |
| 1128 | /* |
| 1129 | ** Return true if the database is writeable |
| 1130 | */ |
| @@ -1139,14 +1139,14 @@ | |
| 1139 | void db_verify_schema(void){ |
| 1140 | if( db_schema_is_outofdate() ){ |
| 1141 | #ifdef FOSSIL_ENABLE_JSON |
| 1142 | g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD; |
| 1143 | #endif |
| 1144 | fossil_warning("incorrect repository schema version"); |
| 1145 | fossil_warning("your repository has schema version \"%s\" " |
| 1146 | "but this binary expects version \"%s\"", |
| 1147 | db_get("aux-schema",0), AUX_SCHEMA); |
| 1148 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | |
| @@ -1394,11 +1394,11 @@ | |
| 1394 | char *zDate; |
| 1395 | Blob hash; |
| 1396 | Blob manifest; |
| 1397 | |
| 1398 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1399 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 1400 | db_set("rebuilt", get_version(), 0); |
| 1401 | if( makeServerCodes ){ |
| 1402 | db_setup_server_and_project_codes(0); |
| 1403 | } |
| 1404 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1405 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1118,13 +1118,13 @@ | |
| 1118 | |
| 1119 | /* |
| 1120 | ** Return TRUE if the schema is out-of-date |
| 1121 | */ |
| 1122 | int db_schema_is_outofdate(void){ |
| 1123 | if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema",""); |
| 1124 | return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0 |
| 1125 | || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0; |
| 1126 | } |
| 1127 | |
| 1128 | /* |
| 1129 | ** Return true if the database is writeable |
| 1130 | */ |
| @@ -1139,14 +1139,14 @@ | |
| 1139 | void db_verify_schema(void){ |
| 1140 | if( db_schema_is_outofdate() ){ |
| 1141 | #ifdef FOSSIL_ENABLE_JSON |
| 1142 | g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD; |
| 1143 | #endif |
| 1144 | fossil_warning("incorrect repository schema version: " |
| 1145 | "current repository schema version is \"%s\" " |
| 1146 | "but need versions between \"%s\" and \"%s\".", |
| 1147 | g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX); |
| 1148 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | |
| @@ -1394,11 +1394,11 @@ | |
| 1394 | char *zDate; |
| 1395 | Blob hash; |
| 1396 | Blob manifest; |
| 1397 | |
| 1398 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1399 | db_set("aux-schema", AUX_SCHEMA_MAX, 0); |
| 1400 | db_set("rebuilt", get_version(), 0); |
| 1401 | if( makeServerCodes ){ |
| 1402 | db_setup_server_and_project_codes(0); |
| 1403 | } |
| 1404 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1405 |
M
src/db.c
+8
-8
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1118,13 +1118,13 @@ | ||
| 1118 | 1118 | |
| 1119 | 1119 | /* |
| 1120 | 1120 | ** Return TRUE if the schema is out-of-date |
| 1121 | 1121 | */ |
| 1122 | 1122 | int db_schema_is_outofdate(void){ |
| 1123 | - return db_exists("SELECT 1 FROM config" | |
| 1124 | - " WHERE name='aux-schema'" | |
| 1125 | - " AND value<>%Q", AUX_SCHEMA); | |
| 1123 | + if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema",""); | |
| 1124 | + return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0 | |
| 1125 | + || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0; | |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | /* |
| 1129 | 1129 | ** Return true if the database is writeable |
| 1130 | 1130 | */ |
| @@ -1139,14 +1139,14 @@ | ||
| 1139 | 1139 | void db_verify_schema(void){ |
| 1140 | 1140 | if( db_schema_is_outofdate() ){ |
| 1141 | 1141 | #ifdef FOSSIL_ENABLE_JSON |
| 1142 | 1142 | g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD; |
| 1143 | 1143 | #endif |
| 1144 | - fossil_warning("incorrect repository schema version"); | |
| 1145 | - fossil_warning("your repository has schema version \"%s\" " | |
| 1146 | - "but this binary expects version \"%s\"", | |
| 1147 | - db_get("aux-schema",0), AUX_SCHEMA); | |
| 1144 | + fossil_warning("incorrect repository schema version: " | |
| 1145 | + "current repository schema version is \"%s\" " | |
| 1146 | + "but need versions between \"%s\" and \"%s\".", | |
| 1147 | + g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX); | |
| 1148 | 1148 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | |
| @@ -1394,11 +1394,11 @@ | ||
| 1394 | 1394 | char *zDate; |
| 1395 | 1395 | Blob hash; |
| 1396 | 1396 | Blob manifest; |
| 1397 | 1397 | |
| 1398 | 1398 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1399 | - db_set("aux-schema", AUX_SCHEMA, 0); | |
| 1399 | + db_set("aux-schema", AUX_SCHEMA_MAX, 0); | |
| 1400 | 1400 | db_set("rebuilt", get_version(), 0); |
| 1401 | 1401 | if( makeServerCodes ){ |
| 1402 | 1402 | db_setup_server_and_project_codes(0); |
| 1403 | 1403 | } |
| 1404 | 1404 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1405 | 1405 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1118,13 +1118,13 @@ | |
| 1118 | |
| 1119 | /* |
| 1120 | ** Return TRUE if the schema is out-of-date |
| 1121 | */ |
| 1122 | int db_schema_is_outofdate(void){ |
| 1123 | return db_exists("SELECT 1 FROM config" |
| 1124 | " WHERE name='aux-schema'" |
| 1125 | " AND value<>%Q", AUX_SCHEMA); |
| 1126 | } |
| 1127 | |
| 1128 | /* |
| 1129 | ** Return true if the database is writeable |
| 1130 | */ |
| @@ -1139,14 +1139,14 @@ | |
| 1139 | void db_verify_schema(void){ |
| 1140 | if( db_schema_is_outofdate() ){ |
| 1141 | #ifdef FOSSIL_ENABLE_JSON |
| 1142 | g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD; |
| 1143 | #endif |
| 1144 | fossil_warning("incorrect repository schema version"); |
| 1145 | fossil_warning("your repository has schema version \"%s\" " |
| 1146 | "but this binary expects version \"%s\"", |
| 1147 | db_get("aux-schema",0), AUX_SCHEMA); |
| 1148 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | |
| @@ -1394,11 +1394,11 @@ | |
| 1394 | char *zDate; |
| 1395 | Blob hash; |
| 1396 | Blob manifest; |
| 1397 | |
| 1398 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1399 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 1400 | db_set("rebuilt", get_version(), 0); |
| 1401 | if( makeServerCodes ){ |
| 1402 | db_setup_server_and_project_codes(0); |
| 1403 | } |
| 1404 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1405 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1118,13 +1118,13 @@ | |
| 1118 | |
| 1119 | /* |
| 1120 | ** Return TRUE if the schema is out-of-date |
| 1121 | */ |
| 1122 | int db_schema_is_outofdate(void){ |
| 1123 | if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema",""); |
| 1124 | return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0 |
| 1125 | || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0; |
| 1126 | } |
| 1127 | |
| 1128 | /* |
| 1129 | ** Return true if the database is writeable |
| 1130 | */ |
| @@ -1139,14 +1139,14 @@ | |
| 1139 | void db_verify_schema(void){ |
| 1140 | if( db_schema_is_outofdate() ){ |
| 1141 | #ifdef FOSSIL_ENABLE_JSON |
| 1142 | g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD; |
| 1143 | #endif |
| 1144 | fossil_warning("incorrect repository schema version: " |
| 1145 | "current repository schema version is \"%s\" " |
| 1146 | "but need versions between \"%s\" and \"%s\".", |
| 1147 | g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX); |
| 1148 | fossil_fatal("run \"fossil rebuild\" to fix this problem"); |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | |
| @@ -1394,11 +1394,11 @@ | |
| 1394 | char *zDate; |
| 1395 | Blob hash; |
| 1396 | Blob manifest; |
| 1397 | |
| 1398 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 1399 | db_set("aux-schema", AUX_SCHEMA_MAX, 0); |
| 1400 | db_set("rebuilt", get_version(), 0); |
| 1401 | if( makeServerCodes ){ |
| 1402 | db_setup_server_and_project_codes(0); |
| 1403 | } |
| 1404 | if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0); |
| 1405 |
+2
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -125,10 +125,11 @@ | ||
| 125 | 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | + char *zAuxSchema; /* Main repository aux-schema */ | |
| 130 | 131 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | 132 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 132 | 133 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 133 | 134 | int repositoryOpen; /* True if the main repository database is open */ |
| 134 | 135 | char *zRepositoryOption; /* Most recent cached repository option value */ |
| @@ -970,11 +971,11 @@ | ||
| 970 | 971 | const char *zRc; |
| 971 | 972 | #endif |
| 972 | 973 | fossil_print("Compiled on %s %s using %s (%d-bit)\n", |
| 973 | 974 | __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); |
| 974 | 975 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 975 | - fossil_print("Schema version %s\n", AUX_SCHEMA); | |
| 976 | + fossil_print("Schema version %s\n", AUX_SCHEMA_MAX); | |
| 976 | 977 | #if defined(FOSSIL_ENABLE_MINIZ) |
| 977 | 978 | fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version()); |
| 978 | 979 | #else |
| 979 | 980 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 980 | 981 | #endif |
| 981 | 982 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -125,10 +125,11 @@ | |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 132 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 133 | int repositoryOpen; /* True if the main repository database is open */ |
| 134 | char *zRepositoryOption; /* Most recent cached repository option value */ |
| @@ -970,11 +971,11 @@ | |
| 970 | const char *zRc; |
| 971 | #endif |
| 972 | fossil_print("Compiled on %s %s using %s (%d-bit)\n", |
| 973 | __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); |
| 974 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 975 | fossil_print("Schema version %s\n", AUX_SCHEMA); |
| 976 | #if defined(FOSSIL_ENABLE_MINIZ) |
| 977 | fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version()); |
| 978 | #else |
| 979 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 980 | #endif |
| 981 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -125,10 +125,11 @@ | |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | char *zAuxSchema; /* Main repository aux-schema */ |
| 131 | int useAttach; /* True if global_config is attached to repository */ |
| 132 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 133 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 134 | int repositoryOpen; /* True if the main repository database is open */ |
| 135 | char *zRepositoryOption; /* Most recent cached repository option value */ |
| @@ -970,11 +971,11 @@ | |
| 971 | const char *zRc; |
| 972 | #endif |
| 973 | fossil_print("Compiled on %s %s using %s (%d-bit)\n", |
| 974 | __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); |
| 975 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 976 | fossil_print("Schema version %s\n", AUX_SCHEMA_MAX); |
| 977 | #if defined(FOSSIL_ENABLE_MINIZ) |
| 978 | fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version()); |
| 979 | #else |
| 980 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 981 | #endif |
| 982 |
+2
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -125,10 +125,11 @@ | ||
| 125 | 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | + char *zAuxSchema; /* Main repository aux-schema */ | |
| 130 | 131 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | 132 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 132 | 133 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 133 | 134 | int repositoryOpen; /* True if the main repository database is open */ |
| 134 | 135 | char *zRepositoryOption; /* Most recent cached repository option value */ |
| @@ -970,11 +971,11 @@ | ||
| 970 | 971 | const char *zRc; |
| 971 | 972 | #endif |
| 972 | 973 | fossil_print("Compiled on %s %s using %s (%d-bit)\n", |
| 973 | 974 | __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); |
| 974 | 975 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 975 | - fossil_print("Schema version %s\n", AUX_SCHEMA); | |
| 976 | + fossil_print("Schema version %s\n", AUX_SCHEMA_MAX); | |
| 976 | 977 | #if defined(FOSSIL_ENABLE_MINIZ) |
| 977 | 978 | fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version()); |
| 978 | 979 | #else |
| 979 | 980 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 980 | 981 | #endif |
| 981 | 982 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -125,10 +125,11 @@ | |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 132 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 133 | int repositoryOpen; /* True if the main repository database is open */ |
| 134 | char *zRepositoryOption; /* Most recent cached repository option value */ |
| @@ -970,11 +971,11 @@ | |
| 970 | const char *zRc; |
| 971 | #endif |
| 972 | fossil_print("Compiled on %s %s using %s (%d-bit)\n", |
| 973 | __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); |
| 974 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 975 | fossil_print("Schema version %s\n", AUX_SCHEMA); |
| 976 | #if defined(FOSSIL_ENABLE_MINIZ) |
| 977 | fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version()); |
| 978 | #else |
| 979 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 980 | #endif |
| 981 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -125,10 +125,11 @@ | |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | char *zAuxSchema; /* Main repository aux-schema */ |
| 131 | int useAttach; /* True if global_config is attached to repository */ |
| 132 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 133 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 134 | int repositoryOpen; /* True if the main repository database is open */ |
| 135 | char *zRepositoryOption; /* Most recent cached repository option value */ |
| @@ -970,11 +971,11 @@ | |
| 971 | const char *zRc; |
| 972 | #endif |
| 973 | fossil_print("Compiled on %s %s using %s (%d-bit)\n", |
| 974 | __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); |
| 975 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 976 | fossil_print("Schema version %s\n", AUX_SCHEMA_MAX); |
| 977 | #if defined(FOSSIL_ENABLE_MINIZ) |
| 978 | fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version()); |
| 979 | #else |
| 980 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 981 | #endif |
| 982 |
+22
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1774,14 +1774,34 @@ | ||
| 1774 | 1774 | zScript = xfer_commit_code(); |
| 1775 | 1775 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1776 | 1776 | } |
| 1777 | 1777 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1778 | 1778 | char *zCom; |
| 1779 | + char zBaseId[30]; | |
| 1780 | + if( p->zBaseline ){ | |
| 1781 | + sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", | |
| 1782 | + uuid_to_rid(p->zBaseline,1)); | |
| 1783 | + }else{ | |
| 1784 | + sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL"); | |
| 1785 | + } | |
| 1786 | + (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */ | |
| 1779 | 1787 | for(i=0; i<p->nParent; i++){ |
| 1780 | 1788 | int pid = uuid_to_rid(p->azParent[i], 1); |
| 1781 | - db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)" | |
| 1782 | - "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate); | |
| 1789 | + if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){ | |
| 1790 | + /* Support for PLINK.BASEID added on 2014-11-24 */ | |
| 1791 | + db_multi_exec( | |
| 1792 | + "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)" | |
| 1793 | + "VALUES(%d, %d, %d, %.17g, %s)", | |
| 1794 | + pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/); | |
| 1795 | + }else{ | |
| 1796 | + /* Continue to work with older schema to avoid an unnecessary | |
| 1797 | + ** rebuild */ | |
| 1798 | + db_multi_exec( | |
| 1799 | + "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)" | |
| 1800 | + "VALUES(%d, %d, %d, %.17g)", | |
| 1801 | + pid, rid, i==0, p->rDate); | |
| 1802 | + } | |
| 1783 | 1803 | if( i==0 ){ |
| 1784 | 1804 | add_mlink(pid, 0, rid, p); |
| 1785 | 1805 | parentid = pid; |
| 1786 | 1806 | } |
| 1787 | 1807 | } |
| 1788 | 1808 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1774,14 +1774,34 @@ | |
| 1774 | zScript = xfer_commit_code(); |
| 1775 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1776 | } |
| 1777 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1778 | char *zCom; |
| 1779 | for(i=0; i<p->nParent; i++){ |
| 1780 | int pid = uuid_to_rid(p->azParent[i], 1); |
| 1781 | db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)" |
| 1782 | "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate); |
| 1783 | if( i==0 ){ |
| 1784 | add_mlink(pid, 0, rid, p); |
| 1785 | parentid = pid; |
| 1786 | } |
| 1787 | } |
| 1788 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1774,14 +1774,34 @@ | |
| 1774 | zScript = xfer_commit_code(); |
| 1775 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1776 | } |
| 1777 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ |
| 1778 | char *zCom; |
| 1779 | char zBaseId[30]; |
| 1780 | if( p->zBaseline ){ |
| 1781 | sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", |
| 1782 | uuid_to_rid(p->zBaseline,1)); |
| 1783 | }else{ |
| 1784 | sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL"); |
| 1785 | } |
| 1786 | (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */ |
| 1787 | for(i=0; i<p->nParent; i++){ |
| 1788 | int pid = uuid_to_rid(p->azParent[i], 1); |
| 1789 | if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){ |
| 1790 | /* Support for PLINK.BASEID added on 2014-11-24 */ |
| 1791 | db_multi_exec( |
| 1792 | "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)" |
| 1793 | "VALUES(%d, %d, %d, %.17g, %s)", |
| 1794 | pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/); |
| 1795 | }else{ |
| 1796 | /* Continue to work with older schema to avoid an unnecessary |
| 1797 | ** rebuild */ |
| 1798 | db_multi_exec( |
| 1799 | "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)" |
| 1800 | "VALUES(%d, %d, %d, %.17g)", |
| 1801 | pid, rid, i==0, p->rDate); |
| 1802 | } |
| 1803 | if( i==0 ){ |
| 1804 | add_mlink(pid, 0, rid, p); |
| 1805 | parentid = pid; |
| 1806 | } |
| 1807 | } |
| 1808 |
+1
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -591,11 +591,11 @@ | ||
| 591 | 591 | reconstruct_private_table(); |
| 592 | 592 | db_multi_exec( |
| 593 | 593 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());" |
| 594 | 594 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());" |
| 595 | 595 | "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());", |
| 596 | - CONTENT_SCHEMA, AUX_SCHEMA, get_version() | |
| 596 | + CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version() | |
| 597 | 597 | ); |
| 598 | 598 | if( errCnt && !forceFlag ){ |
| 599 | 599 | fossil_print( |
| 600 | 600 | "%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 601 | 601 | errCnt |
| 602 | 602 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -591,11 +591,11 @@ | |
| 591 | reconstruct_private_table(); |
| 592 | db_multi_exec( |
| 593 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());" |
| 594 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());" |
| 595 | "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());", |
| 596 | CONTENT_SCHEMA, AUX_SCHEMA, get_version() |
| 597 | ); |
| 598 | if( errCnt && !forceFlag ){ |
| 599 | fossil_print( |
| 600 | "%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 601 | errCnt |
| 602 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -591,11 +591,11 @@ | |
| 591 | reconstruct_private_table(); |
| 592 | db_multi_exec( |
| 593 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());" |
| 594 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());" |
| 595 | "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());", |
| 596 | CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version() |
| 597 | ); |
| 598 | if( errCnt && !forceFlag ){ |
| 599 | fossil_print( |
| 600 | "%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 601 | errCnt |
| 602 |
+3
-1
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -44,11 +44,12 @@ | ||
| 44 | 44 | ** a date) which can change frequently. When the content schema changes, |
| 45 | 45 | ** we have to execute special procedures to update the schema. When |
| 46 | 46 | ** the aux schema changes, all we need to do is rebuild the database. |
| 47 | 47 | */ |
| 48 | 48 | #define CONTENT_SCHEMA "2" |
| 49 | -#define AUX_SCHEMA "2011-04-25 19:50" | |
| 49 | +#define AUX_SCHEMA_MIN "2011-04-25 19:50" | |
| 50 | +#define AUX_SCHEMA_MAX "2014-11-24 20:35" | |
| 50 | 51 | |
| 51 | 52 | #endif /* INTERFACE */ |
| 52 | 53 | |
| 53 | 54 | |
| 54 | 55 | /* |
| @@ -250,10 +251,11 @@ | ||
| 250 | 251 | @ CREATE TABLE plink( |
| 251 | 252 | @ pid INTEGER REFERENCES blob, -- Parent manifest |
| 252 | 253 | @ cid INTEGER REFERENCES blob, -- Child manifest |
| 253 | 254 | @ isprim BOOLEAN, -- pid is the primary parent of cid |
| 254 | 255 | @ mtime DATETIME, -- the date/time stamp on cid. Julian day. |
| 256 | +@ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest | |
| 255 | 257 | @ UNIQUE(pid, cid) |
| 256 | 258 | @ ); |
| 257 | 259 | @ CREATE INDEX plink_i2 ON plink(cid,pid); |
| 258 | 260 | @ |
| 259 | 261 | @ -- A "leaf" checkin is a checkin that has no children in the same |
| 260 | 262 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -44,11 +44,12 @@ | |
| 44 | ** a date) which can change frequently. When the content schema changes, |
| 45 | ** we have to execute special procedures to update the schema. When |
| 46 | ** the aux schema changes, all we need to do is rebuild the database. |
| 47 | */ |
| 48 | #define CONTENT_SCHEMA "2" |
| 49 | #define AUX_SCHEMA "2011-04-25 19:50" |
| 50 | |
| 51 | #endif /* INTERFACE */ |
| 52 | |
| 53 | |
| 54 | /* |
| @@ -250,10 +251,11 @@ | |
| 250 | @ CREATE TABLE plink( |
| 251 | @ pid INTEGER REFERENCES blob, -- Parent manifest |
| 252 | @ cid INTEGER REFERENCES blob, -- Child manifest |
| 253 | @ isprim BOOLEAN, -- pid is the primary parent of cid |
| 254 | @ mtime DATETIME, -- the date/time stamp on cid. Julian day. |
| 255 | @ UNIQUE(pid, cid) |
| 256 | @ ); |
| 257 | @ CREATE INDEX plink_i2 ON plink(cid,pid); |
| 258 | @ |
| 259 | @ -- A "leaf" checkin is a checkin that has no children in the same |
| 260 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -44,11 +44,12 @@ | |
| 44 | ** a date) which can change frequently. When the content schema changes, |
| 45 | ** we have to execute special procedures to update the schema. When |
| 46 | ** the aux schema changes, all we need to do is rebuild the database. |
| 47 | */ |
| 48 | #define CONTENT_SCHEMA "2" |
| 49 | #define AUX_SCHEMA_MIN "2011-04-25 19:50" |
| 50 | #define AUX_SCHEMA_MAX "2014-11-24 20:35" |
| 51 | |
| 52 | #endif /* INTERFACE */ |
| 53 | |
| 54 | |
| 55 | /* |
| @@ -250,10 +251,11 @@ | |
| 251 | @ CREATE TABLE plink( |
| 252 | @ pid INTEGER REFERENCES blob, -- Parent manifest |
| 253 | @ cid INTEGER REFERENCES blob, -- Child manifest |
| 254 | @ isprim BOOLEAN, -- pid is the primary parent of cid |
| 255 | @ mtime DATETIME, -- the date/time stamp on cid. Julian day. |
| 256 | @ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest |
| 257 | @ UNIQUE(pid, cid) |
| 258 | @ ); |
| 259 | @ CREATE INDEX plink_i2 ON plink(cid,pid); |
| 260 | @ |
| 261 | @ -- A "leaf" checkin is a checkin that has no children in the same |
| 262 |