Fossil

Check-in [2cce7d19]
Login

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

Overview
Comment:Update "fossil rebuild" so that it changes the CHECK constraint on the BLOB table to be "length(uuid)>=40" instead of "==40".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fossil-2.0
Files: files | file ages | folders
SHA1:2cce7d19d69378ef5c42cc576ffed5428f002a24
User & Date: drh 2017-02-28 02:10:13
Context
2017-02-28
09:16
Change the version number to 2.0. check-in: 81a73593 user: drh tags: fossil-2.0
02:10
Update "fossil rebuild" so that it changes the CHECK constraint on the BLOB table to be "length(uuid)>=40" instead of "==40". check-in: 2cce7d19 user: drh tags: fossil-2.0
00:56
Relax size constraints on artifact hash parsing. check-in: 65c59711 user: drh tags: fossil-2.0
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/rebuild.c.

93
94
95
96
97
98
99

100
101
102
103
104
105
106
...
170
171
172
173
174
175
176
























177
178
179
180
181
182
183
;

/*
** Update the schema as necessary
*/
static void rebuild_update_schema(void){
  int rc;

  db_multi_exec("%s", zSchemaUpdates1 /*safe-for-%s*/);
  db_multi_exec("%s", zSchemaUpdates2 /*safe-for-%s*/);

  /* Add the user.mtime column if it is missing.
  */
  if( !db_table_has_column("repository", "user", "mtime") ){
    db_multi_exec(
................................................................................
    );
  }

  /* If the alias table is missing, create it. */
  if( !db_table_exists("repository", "alias") ){
    db_multi_exec("%s", zSchemaUpdate3/*safe-for-%s*/);
  }
























}

/*
** Variables used to store state information about an on-going "rebuild"
** or "deconstruct".
*/
static int totalSize;       /* Total number of artifacts to process */







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
;

/*
** Update the schema as necessary
*/
static void rebuild_update_schema(void){
  int rc;
  char *z;
  db_multi_exec("%s", zSchemaUpdates1 /*safe-for-%s*/);
  db_multi_exec("%s", zSchemaUpdates2 /*safe-for-%s*/);

  /* Add the user.mtime column if it is missing.
  */
  if( !db_table_has_column("repository", "user", "mtime") ){
    db_multi_exec(
................................................................................
    );
  }

  /* If the alias table is missing, create it. */
  if( !db_table_exists("repository", "alias") ){
    db_multi_exec("%s", zSchemaUpdate3/*safe-for-%s*/);
  }

  /* Make sure the CHECK constraint on the BLOB table says "length(uuid)>=40"
  ** instead of "length(uuid)==40". */
  z = db_text(0, "SELECT sql FROM repository.sqlite_master WHERE"
                 " name LIKE 'blob' AND sql LIKE '%%length(uuid)==40%%'");
  if( z ){
    /* Search for:  length(uuid)==40
    **              0123456789 12345   */
    int i;
    for(i=10; z[i]; i++){
      if( z[i]=='=' && strncmp(&z[i-6],"(uuid)==40",10)==0 ){
        z[i] = '>';
        db_multi_exec(
           "PRAGMA writable_schema=ON;"
           "UPDATE repository.sqlite_master SET sql=%Q WHERE name LIKE 'blob';"
           "PRAGMA writable_schema=OFF;",
           z
        );
        break;
      }
    }
    fossil_free(z);
  }
      
}

/*
** Variables used to store state information about an on-going "rebuild"
** or "deconstruct".
*/
static int totalSize;       /* Total number of artifacts to process */

Changes to src/schema.c.

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@ --
@ CREATE TABLE blob(
@   rid INTEGER PRIMARY KEY,        -- Record ID
@   rcvid INTEGER,                  -- Origin of this record
@   size INTEGER,                   -- Size of content. -1 for a phantom.
@   uuid TEXT UNIQUE NOT NULL,      -- hash of the content
@   content BLOB,                   -- Compressed content of this record
@   CHECK( length(uuid)==40 AND rid>0 )
@ );
@ CREATE TABLE delta(
@   rid INTEGER PRIMARY KEY,                 -- BLOB that is delta-compressed
@   srcid INTEGER NOT NULL REFERENCES blob   -- Baseline for delta-compression
@ );
@ CREATE INDEX delta_i1 ON delta(srcid);
@







|







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@ --
@ CREATE TABLE blob(
@   rid INTEGER PRIMARY KEY,        -- Record ID
@   rcvid INTEGER,                  -- Origin of this record
@   size INTEGER,                   -- Size of content. -1 for a phantom.
@   uuid TEXT UNIQUE NOT NULL,      -- hash of the content
@   content BLOB,                   -- Compressed content of this record
@   CHECK( length(uuid)>=40 AND rid>0 )
@ );
@ CREATE TABLE delta(
@   rid INTEGER PRIMARY KEY,                 -- BLOB that is delta-compressed
@   srcid INTEGER NOT NULL REFERENCES blob   -- Baseline for delta-compression
@ );
@ CREATE INDEX delta_i1 ON delta(srcid);
@