Fossil

Check-in [a7caaea559]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor tweaks to the aux-schema management logic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | baseline-in-plink
Files: files | file ages | folders
SHA1: a7caaea55981c62f1a55be5b74c5dde4938f3428
User & Date: drh 2014-11-28 15:33:06.076
Context
2014-11-28
15:36
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". check-in: 5dd8b2dabe user: drh tags: trunk
15:33
Minor tweaks to the aux-schema management logic. Closed-Leaf check-in: a7caaea559 user: drh tags: baseline-in-plink
14:41
Make sure the g.zAuxSchema value is initialized before trying to use it when doing a rebuild. check-in: 2a715a89a0 user: drh tags: baseline-in-plink
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
  return zDb;
}

/*
** Return TRUE if the schema is out-of-date
*/
int db_schema_is_outofdate(void){
  g.zAuxSchema = db_text(0, "SELECT value FROM config WHERE name='aux-schema'");
  return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
      || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
}

/*
** Return true if the database is writeable
*/







|







1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
  return zDb;
}

/*
** Return TRUE if the schema is out-of-date
*/
int db_schema_is_outofdate(void){
  if( g.zAuxSchema==0 ) g.zAuxSchema = db_get("aux-schema","");
  return strcmp(g.zAuxSchema,AUX_SCHEMA_MIN)<0
      || strcmp(g.zAuxSchema,AUX_SCHEMA_MAX)>0;
}

/*
** Return true if the database is writeable
*/
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
  if( db_schema_is_outofdate() ){
#ifdef FOSSIL_ENABLE_JSON
    g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
#endif
    fossil_warning("incorrect repository schema version: "
          "current repository schema version is \"%s\" "
          "but need versions between \"%s\" and \"%s\".",
          db_get("aux-schema",0), AUX_SCHEMA_MIN, AUX_SCHEMA_MAX);
    fossil_fatal("run \"fossil rebuild\" to fix this problem");
  }
}


/*
** COMMAND: test-move-repository







|







1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
  if( db_schema_is_outofdate() ){
#ifdef FOSSIL_ENABLE_JSON
    g.json.resultCode = FSL_JSON_E_DB_NEEDS_REBUILD;
#endif
    fossil_warning("incorrect repository schema version: "
          "current repository schema version is \"%s\" "
          "but need versions between \"%s\" and \"%s\".",
          g.zAuxSchema, AUX_SCHEMA_MIN, AUX_SCHEMA_MAX);
    fossil_fatal("run \"fossil rebuild\" to fix this problem");
  }
}


/*
** COMMAND: test-move-repository
Changes to src/manifest.c.
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
      char zBaseId[30];
      if( p->zBaseline ){
        sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
                         uuid_to_rid(p->zBaseline,1));
      }else{
        sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
      }
      if( g.zAuxSchema==0 ) (void)db_schema_is_outofdate();
      for(i=0; i<p->nParent; i++){
        int pid = uuid_to_rid(p->azParent[i], 1);
        if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){
          /* Support for PLINK.BASEID added on 2014-11-24 */
          db_multi_exec(
             "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
             "VALUES(%d, %d, %d, %.17g, %s)",







|







1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
      char zBaseId[30];
      if( p->zBaseline ){
        sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
                         uuid_to_rid(p->zBaseline,1));
      }else{
        sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
      }
      (void)db_schema_is_outofdate(); /* Make sure g.zAuxSchema is initialized */
      for(i=0; i<p->nParent; i++){
        int pid = uuid_to_rid(p->azParent[i], 1);
        if( strcmp(g.zAuxSchema,"2014-11-24 20:35")>=0 ){
          /* Support for PLINK.BASEID added on 2014-11-24 */
          db_multi_exec(
             "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)"
             "VALUES(%d, %d, %d, %.17g, %s)",