Fossil SCM

Do not create the ALIAS table as it turns out not to be needed.

drh 2017-03-01 15:09 fossil-2.0
Commit 3259aa5421f85fc87c248dacd1adce13adf19318
3 files changed +1 -3 +2 -24 -16
+1 -3
--- src/db.c
+++ src/db.c
@@ -1489,13 +1489,11 @@
14891489
g.zAuxSchema = db_get("aux-schema","");
14901490
14911491
/* If the ALIAS table is not present, then some on-the-fly schema
14921492
** updates might be required.
14931493
*/
1494
- if( !db_table_exists("repository","alias") ){
1495
- rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */
1496
- }
1494
+ rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */
14971495
}
14981496
14991497
/*
15001498
** Flags for the db_find_and_open_repository() function.
15011499
*/
15021500
--- src/db.c
+++ src/db.c
@@ -1489,13 +1489,11 @@
1489 g.zAuxSchema = db_get("aux-schema","");
1490
1491 /* If the ALIAS table is not present, then some on-the-fly schema
1492 ** updates might be required.
1493 */
1494 if( !db_table_exists("repository","alias") ){
1495 rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */
1496 }
1497 }
1498
1499 /*
1500 ** Flags for the db_find_and_open_repository() function.
1501 */
1502
--- src/db.c
+++ src/db.c
@@ -1489,13 +1489,11 @@
1489 g.zAuxSchema = db_get("aux-schema","");
1490
1491 /* If the ALIAS table is not present, then some on-the-fly schema
1492 ** updates might be required.
1493 */
1494 rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */
 
 
1495 }
1496
1497 /*
1498 ** Flags for the db_find_and_open_repository() function.
1499 */
1500
+2 -24
--- src/rebuild.c
+++ src/rebuild.c
@@ -140,37 +140,15 @@
140140
rebuild_schema_update_2_0();
141141
}
142142
143143
/*
144144
** Update the repository schema for Fossil version 2.0. (2017-02-28)
145
-** (1) Create the ALIAS table
146
-** (2) Change the CHECK constraint on BLOB.UUID so that the length
145
+** (1) Change the CHECK constraint on BLOB.UUID so that the length
147146
** is greater than or equal to 40, not exactly equal to 40.
148147
*/
149148
void rebuild_schema_update_2_0(void){
150
- static const char zCreateAliasTable[] =
151
- @ -- Make sure the alias table exists.
152
- @ --
153
- @ CREATE TABLE repository.alias(
154
- @ hval TEXT, -- Hex-encoded hash value
155
- @ htype ANY, -- Type of hash.
156
- @ rid INTEGER REFERENCES blob, -- Blob that this hash names
157
- @ PRIMARY KEY(hval,htype,rid)
158
- @ ) WITHOUT ROWID;
159
- @ CREATE INDEX repository.alias_rid ON alias(rid);
160
- ;
161
- char *z;
162
-
163
- /* If the alias table is missing, create it. */
164
- if( !db_table_exists("repository", "alias") ){
165
- db_multi_exec("%s", zCreateAliasTable/*safe-for-%s*/);
166
- }
167
-
168
- /* Make sure the CHECK constraint on the BLOB table says "length(uuid)>=40"
169
- ** instead of "length(uuid)==40". */
170
- z = db_text(0, "SELECT sql FROM repository.sqlite_master WHERE"
171
- " name LIKE 'blob' AND sql LIKE '%%length(uuid)==40%%'");
149
+ char *z = db_text(0, "SELECT sql FROM repository.sqlite_master WHERE name='blob'");
172150
if( z ){
173151
/* Search for: length(uuid)==40
174152
** 0123456789 12345 */
175153
int i;
176154
for(i=10; z[i]; i++){
177155
--- src/rebuild.c
+++ src/rebuild.c
@@ -140,37 +140,15 @@
140 rebuild_schema_update_2_0();
141 }
142
143 /*
144 ** Update the repository schema for Fossil version 2.0. (2017-02-28)
145 ** (1) Create the ALIAS table
146 ** (2) Change the CHECK constraint on BLOB.UUID so that the length
147 ** is greater than or equal to 40, not exactly equal to 40.
148 */
149 void rebuild_schema_update_2_0(void){
150 static const char zCreateAliasTable[] =
151 @ -- Make sure the alias table exists.
152 @ --
153 @ CREATE TABLE repository.alias(
154 @ hval TEXT, -- Hex-encoded hash value
155 @ htype ANY, -- Type of hash.
156 @ rid INTEGER REFERENCES blob, -- Blob that this hash names
157 @ PRIMARY KEY(hval,htype,rid)
158 @ ) WITHOUT ROWID;
159 @ CREATE INDEX repository.alias_rid ON alias(rid);
160 ;
161 char *z;
162
163 /* If the alias table is missing, create it. */
164 if( !db_table_exists("repository", "alias") ){
165 db_multi_exec("%s", zCreateAliasTable/*safe-for-%s*/);
166 }
167
168 /* Make sure the CHECK constraint on the BLOB table says "length(uuid)>=40"
169 ** instead of "length(uuid)==40". */
170 z = db_text(0, "SELECT sql FROM repository.sqlite_master WHERE"
171 " name LIKE 'blob' AND sql LIKE '%%length(uuid)==40%%'");
172 if( z ){
173 /* Search for: length(uuid)==40
174 ** 0123456789 12345 */
175 int i;
176 for(i=10; z[i]; i++){
177
--- src/rebuild.c
+++ src/rebuild.c
@@ -140,37 +140,15 @@
140 rebuild_schema_update_2_0();
141 }
142
143 /*
144 ** Update the repository schema for Fossil version 2.0. (2017-02-28)
145 ** (1) Change the CHECK constraint on BLOB.UUID so that the length
 
146 ** is greater than or equal to 40, not exactly equal to 40.
147 */
148 void rebuild_schema_update_2_0(void){
149 char *z = db_text(0, "SELECT sql FROM repository.sqlite_master WHERE name='blob'");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150 if( z ){
151 /* Search for: length(uuid)==40
152 ** 0123456789 12345 */
153 int i;
154 for(i=10; z[i]; i++){
155
-16
--- src/schema.c
+++ src/schema.c
@@ -107,26 +107,10 @@
107107
@ mtime DATETIME, -- Time of receipt. Julian day.
108108
@ nonce TEXT UNIQUE, -- Nonce used for login
109109
@ ipaddr TEXT -- Remote IP address. NULL for direct.
110110
@ );
111111
@
112
-@ -- The canonical name of each artifact is given by the BLOB.UUID field.
113
-@ -- But artifacts can also have aliases. Aliases arise, for example, when
114
-@ -- the naming hash algorithm changes, or as a result of trying to provide
115
-@ -- compatibility with a different VCS.
116
-@ --
117
-@ -- Each entry in the ALIAS table provides an alternative name by which an
118
-@ -- artifact can be called.
119
-@ --
120
-@ CREATE TABLE alias(
121
-@ hval TEXT, -- Hex-encoded hash value
122
-@ htype ANY, -- Type of hash.
123
-@ rid INTEGER REFERENCES blob, -- Blob that this hash names
124
-@ PRIMARY KEY(hval,htype,rid)
125
-@ ) WITHOUT ROWID;
126
-@ CREATE INDEX alias_rid ON alias(rid);
127
-@
128112
@ -- Information about users
129113
@ --
130114
@ -- The user.pw field can be either cleartext of the password, or
131115
@ -- a SHA1 hash of the password. If the user.pw field is exactly 40
132116
@ -- characters long we assume it is a SHA1 hash. Otherwise, it is
133117
--- src/schema.c
+++ src/schema.c
@@ -107,26 +107,10 @@
107 @ mtime DATETIME, -- Time of receipt. Julian day.
108 @ nonce TEXT UNIQUE, -- Nonce used for login
109 @ ipaddr TEXT -- Remote IP address. NULL for direct.
110 @ );
111 @
112 @ -- The canonical name of each artifact is given by the BLOB.UUID field.
113 @ -- But artifacts can also have aliases. Aliases arise, for example, when
114 @ -- the naming hash algorithm changes, or as a result of trying to provide
115 @ -- compatibility with a different VCS.
116 @ --
117 @ -- Each entry in the ALIAS table provides an alternative name by which an
118 @ -- artifact can be called.
119 @ --
120 @ CREATE TABLE alias(
121 @ hval TEXT, -- Hex-encoded hash value
122 @ htype ANY, -- Type of hash.
123 @ rid INTEGER REFERENCES blob, -- Blob that this hash names
124 @ PRIMARY KEY(hval,htype,rid)
125 @ ) WITHOUT ROWID;
126 @ CREATE INDEX alias_rid ON alias(rid);
127 @
128 @ -- Information about users
129 @ --
130 @ -- The user.pw field can be either cleartext of the password, or
131 @ -- a SHA1 hash of the password. If the user.pw field is exactly 40
132 @ -- characters long we assume it is a SHA1 hash. Otherwise, it is
133
--- src/schema.c
+++ src/schema.c
@@ -107,26 +107,10 @@
107 @ mtime DATETIME, -- Time of receipt. Julian day.
108 @ nonce TEXT UNIQUE, -- Nonce used for login
109 @ ipaddr TEXT -- Remote IP address. NULL for direct.
110 @ );
111 @
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112 @ -- Information about users
113 @ --
114 @ -- The user.pw field can be either cleartext of the password, or
115 @ -- a SHA1 hash of the password. If the user.pw field is exactly 40
116 @ -- characters long we assume it is a SHA1 hash. Otherwise, it is
117

Keyboard Shortcuts

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