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".

drh 2014-11-28 15:36 trunk merge
Commit 5dd8b2dabead37a4c5f18fa2aa188fbbd48f2a18
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -164,11 +164,11 @@
164164
db_begin_transaction();
165165
db_record_repository_filename(g.argv[3]);
166166
db_initial_setup(0, 0, zDefaultUser, 0);
167167
user_select();
168168
db_set("content-schema", CONTENT_SCHEMA, 0);
169
- db_set("aux-schema", AUX_SCHEMA, 0);
169
+ db_set("aux-schema", AUX_SCHEMA_MAX, 0);
170170
db_set("rebuilt", get_version(), 0);
171171
remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
172172
url_remember();
173173
if( g.zSSLIdentity!=0 ){
174174
/* If the --ssl-identity option was specified, store it as a setting */
175175
--- 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
+8 -8
--- src/db.c
+++ src/db.c
@@ -1118,13 +1118,13 @@
11181118
11191119
/*
11201120
** Return TRUE if the schema is out-of-date
11211121
*/
11221122
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;
11261126
}
11271127
11281128
/*
11291129
** Return true if the database is writeable
11301130
*/
@@ -1139,14 +1139,14 @@
11391139
void db_verify_schema(void){
11401140
if( db_schema_is_outofdate() ){
11411141
#ifdef FOSSIL_ENABLE_JSON
11421142
g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
11431143
#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);
11481148
fossil_fatal("run \"fossil rebuild\" to fix this problem");
11491149
}
11501150
}
11511151
11521152
@@ -1394,11 +1394,11 @@
13941394
char *zDate;
13951395
Blob hash;
13961396
Blob manifest;
13971397
13981398
db_set("content-schema", CONTENT_SCHEMA, 0);
1399
- db_set("aux-schema", AUX_SCHEMA, 0);
1399
+ db_set("aux-schema", AUX_SCHEMA_MAX, 0);
14001400
db_set("rebuilt", get_version(), 0);
14011401
if( makeServerCodes ){
14021402
db_setup_server_and_project_codes(0);
14031403
}
14041404
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
14051405
--- 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
+8 -8
--- src/db.c
+++ src/db.c
@@ -1118,13 +1118,13 @@
11181118
11191119
/*
11201120
** Return TRUE if the schema is out-of-date
11211121
*/
11221122
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;
11261126
}
11271127
11281128
/*
11291129
** Return true if the database is writeable
11301130
*/
@@ -1139,14 +1139,14 @@
11391139
void db_verify_schema(void){
11401140
if( db_schema_is_outofdate() ){
11411141
#ifdef FOSSIL_ENABLE_JSON
11421142
g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
11431143
#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);
11481148
fossil_fatal("run \"fossil rebuild\" to fix this problem");
11491149
}
11501150
}
11511151
11521152
@@ -1394,11 +1394,11 @@
13941394
char *zDate;
13951395
Blob hash;
13961396
Blob manifest;
13971397
13981398
db_set("content-schema", CONTENT_SCHEMA, 0);
1399
- db_set("aux-schema", AUX_SCHEMA, 0);
1399
+ db_set("aux-schema", AUX_SCHEMA_MAX, 0);
14001400
db_set("rebuilt", get_version(), 0);
14011401
if( makeServerCodes ){
14021402
db_setup_server_and_project_codes(0);
14031403
}
14041404
if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
14051405
--- 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 @@
125125
const char *zErrlog; /* Log errors to this file, if not NULL */
126126
int isConst; /* True if the output is unchanging & cacheable */
127127
const char *zVfsName; /* The VFS to use for database connections */
128128
sqlite3 *db; /* The connection to the databases */
129129
sqlite3 *dbConfig; /* Separate connection for global_config table */
130
+ char *zAuxSchema; /* Main repository aux-schema */
130131
int useAttach; /* True if global_config is attached to repository */
131132
const char *zConfigDbName;/* Path of the config database. NULL if not open */
132133
sqlite3_int64 now; /* Seconds since 1970 */
133134
int repositoryOpen; /* True if the main repository database is open */
134135
char *zRepositoryOption; /* Most recent cached repository option value */
@@ -970,11 +971,11 @@
970971
const char *zRc;
971972
#endif
972973
fossil_print("Compiled on %s %s using %s (%d-bit)\n",
973974
__DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
974975
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);
976977
#if defined(FOSSIL_ENABLE_MINIZ)
977978
fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version());
978979
#else
979980
fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
980981
#endif
981982
--- 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 @@
125125
const char *zErrlog; /* Log errors to this file, if not NULL */
126126
int isConst; /* True if the output is unchanging & cacheable */
127127
const char *zVfsName; /* The VFS to use for database connections */
128128
sqlite3 *db; /* The connection to the databases */
129129
sqlite3 *dbConfig; /* Separate connection for global_config table */
130
+ char *zAuxSchema; /* Main repository aux-schema */
130131
int useAttach; /* True if global_config is attached to repository */
131132
const char *zConfigDbName;/* Path of the config database. NULL if not open */
132133
sqlite3_int64 now; /* Seconds since 1970 */
133134
int repositoryOpen; /* True if the main repository database is open */
134135
char *zRepositoryOption; /* Most recent cached repository option value */
@@ -970,11 +971,11 @@
970971
const char *zRc;
971972
#endif
972973
fossil_print("Compiled on %s %s using %s (%d-bit)\n",
973974
__DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8);
974975
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);
976977
#if defined(FOSSIL_ENABLE_MINIZ)
977978
fossil_print("miniz %s, loaded %s\n", MZ_VERSION, mz_version());
978979
#else
979980
fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion());
980981
#endif
981982
--- 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 @@
17741774
zScript = xfer_commit_code();
17751775
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
17761776
}
17771777
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
17781778
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 */
17791787
for(i=0; i<p->nParent; i++){
17801788
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
+ }
17831803
if( i==0 ){
17841804
add_mlink(pid, 0, rid, p);
17851805
parentid = pid;
17861806
}
17871807
}
17881808
--- 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 @@
591591
reconstruct_private_table();
592592
db_multi_exec(
593593
"REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());"
594594
"REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());"
595595
"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()
597597
);
598598
if( errCnt && !forceFlag ){
599599
fossil_print(
600600
"%d errors. Rolling back changes. Use --force to force a commit.\n",
601601
errCnt
602602
--- 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 @@
4444
** a date) which can change frequently. When the content schema changes,
4545
** we have to execute special procedures to update the schema. When
4646
** the aux schema changes, all we need to do is rebuild the database.
4747
*/
4848
#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"
5051
5152
#endif /* INTERFACE */
5253
5354
5455
/*
@@ -250,10 +251,11 @@
250251
@ CREATE TABLE plink(
251252
@ pid INTEGER REFERENCES blob, -- Parent manifest
252253
@ cid INTEGER REFERENCES blob, -- Child manifest
253254
@ isprim BOOLEAN, -- pid is the primary parent of cid
254255
@ mtime DATETIME, -- the date/time stamp on cid. Julian day.
256
+@ baseid INTEGER REFERENCES blob, -- Baseline if child is a delta manifest
255257
@ UNIQUE(pid, cid)
256258
@ );
257259
@ CREATE INDEX plink_i2 ON plink(cid,pid);
258260
@
259261
@ -- A "leaf" checkin is a checkin that has no children in the same
260262
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button