Fossil SCM

Schema enhancements necessary to support the Remark artifact.

drh 2017-01-10 20:38 UTC remarks-on-checkins
Commit f051f1d3d11f8bd0513325dad5eb1dcfc33b9815
+14
--- src/db.c
+++ src/db.c
@@ -1498,10 +1498,24 @@
14981498
"ALTER TABLE repository.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
14991499
"ALTER TABLE repository.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;"
15001500
);
15011501
db_end_transaction(0);
15021502
}
1503
+
1504
+ /* Verify that the REMARK table exists. It was added on 2017-01-10.
1505
+ */
1506
+ if( !db_table_exists("repository","remark") ){
1507
+ db_multi_exec(
1508
+ "CREATE TABLE repository.remark(\n"
1509
+ " rid INTEGER PRIMARY KEY,\n" /* The Remark artifact in BLOB table */
1510
+ " ctime TIMESTAMP,\n" /* Creation date. Julian day. */
1511
+ " target TEXT,\n" /* UUID for check-in or name of branch */
1512
+ " uid TEXT\n" /* Name of user who entered remark */
1513
+ ");\n"
1514
+ "CREATE INDEX repository.remarkidx1 ON remark(target,ctime);"
1515
+ );
1516
+ }
15031517
}
15041518
15051519
/*
15061520
** Flags for the db_find_and_open_repository() function.
15071521
*/
15081522
--- src/db.c
+++ src/db.c
@@ -1498,10 +1498,24 @@
1498 "ALTER TABLE repository.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
1499 "ALTER TABLE repository.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;"
1500 );
1501 db_end_transaction(0);
1502 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1503 }
1504
1505 /*
1506 ** Flags for the db_find_and_open_repository() function.
1507 */
1508
--- src/db.c
+++ src/db.c
@@ -1498,10 +1498,24 @@
1498 "ALTER TABLE repository.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
1499 "ALTER TABLE repository.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;"
1500 );
1501 db_end_transaction(0);
1502 }
1503
1504 /* Verify that the REMARK table exists. It was added on 2017-01-10.
1505 */
1506 if( !db_table_exists("repository","remark") ){
1507 db_multi_exec(
1508 "CREATE TABLE repository.remark(\n"
1509 " rid INTEGER PRIMARY KEY,\n" /* The Remark artifact in BLOB table */
1510 " ctime TIMESTAMP,\n" /* Creation date. Julian day. */
1511 " target TEXT,\n" /* UUID for check-in or name of branch */
1512 " uid TEXT\n" /* Name of user who entered remark */
1513 ");\n"
1514 "CREATE INDEX repository.remarkidx1 ON remark(target,ctime);"
1515 );
1516 }
1517 }
1518
1519 /*
1520 ** Flags for the db_find_and_open_repository() function.
1521 */
1522
--- src/manifest.c
+++ src/manifest.c
@@ -2402,10 +2402,15 @@
24022402
"VALUES('g',%.17g,%d,%Q,%Q)",
24032403
p->rDate, rid, p->zUser, blob_str(&comment)+1
24042404
);
24052405
blob_reset(&comment);
24062406
}
2407
+ if( p->type==CFTYPE_REMARK ){
2408
+ db_multi_exec(
2409
+ "INSERT OR IGNORE INTO remark(rid,target,ctime,uid)"
2410
+ "VALUES(%d,%Q,%.17g,%Q)", p->rid, p->zRemTarget, p->rDate, p->zUser);
2411
+ }
24072412
db_end_transaction(0);
24082413
if( permitHooks ){
24092414
rc = xfer_run_common_script();
24102415
if( rc==TH_OK ){
24112416
rc = xfer_run_script(zScript, zUuid, 0);
24122417
--- src/manifest.c
+++ src/manifest.c
@@ -2402,10 +2402,15 @@
2402 "VALUES('g',%.17g,%d,%Q,%Q)",
2403 p->rDate, rid, p->zUser, blob_str(&comment)+1
2404 );
2405 blob_reset(&comment);
2406 }
 
 
 
 
 
2407 db_end_transaction(0);
2408 if( permitHooks ){
2409 rc = xfer_run_common_script();
2410 if( rc==TH_OK ){
2411 rc = xfer_run_script(zScript, zUuid, 0);
2412
--- src/manifest.c
+++ src/manifest.c
@@ -2402,10 +2402,15 @@
2402 "VALUES('g',%.17g,%d,%Q,%Q)",
2403 p->rDate, rid, p->zUser, blob_str(&comment)+1
2404 );
2405 blob_reset(&comment);
2406 }
2407 if( p->type==CFTYPE_REMARK ){
2408 db_multi_exec(
2409 "INSERT OR IGNORE INTO remark(rid,target,ctime,uid)"
2410 "VALUES(%d,%Q,%.17g,%Q)", p->rid, p->zRemTarget, p->rDate, p->zUser);
2411 }
2412 db_end_transaction(0);
2413 if( permitHooks ){
2414 rc = xfer_run_common_script();
2415 if( rc==TH_OK ){
2416 rc = xfer_run_script(zScript, zUuid, 0);
2417
+11 -1
--- src/schema.c
+++ src/schema.c
@@ -45,11 +45,11 @@
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"
4949
#define AUX_SCHEMA_MIN "2011-04-25 19:50"
50
-#define AUX_SCHEMA_MAX "2015-01-24"
50
+#define AUX_SCHEMA_MAX "2017-01-10"
5151
/* NB: Some features require the latest schema. Warning or error messages
5252
** will appear if an older schema is used. However, the older schemas are
5353
** adequate for many common functions. */
5454
5555
#endif /* INTERFACE */
@@ -453,11 +453,21 @@
453453
@ username TEXT,
454454
@ mimetype TEXT,
455455
@ icomment TEXT
456456
@ );
457457
@ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);
458
+@
459
+@ -- Each remark artifact makes a single entry in the Remark table.
460
+@ CREATE TABLE remark(
461
+@ rid INTEGER PRIMARY KEY, -- The Remark artifact in the BLOB table
462
+@ ctime TIMESTAMP, -- Creation date. Julian day.
463
+@ target TEXT, -- UUID for check-in or name of branch
464
+@ uid TEXT -- Name of user who entered this remark
465
+@ );
466
+@ CREATE INDEX remarkidx1 ON remark(target,ctime);
458467
;
468
+
459469
460470
/*
461471
** Predefined tagid values
462472
*/
463473
#if INTERFACE
464474
--- src/schema.c
+++ src/schema.c
@@ -45,11 +45,11 @@
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 "2015-01-24"
51 /* NB: Some features require the latest schema. Warning or error messages
52 ** will appear if an older schema is used. However, the older schemas are
53 ** adequate for many common functions. */
54
55 #endif /* INTERFACE */
@@ -453,11 +453,21 @@
453 @ username TEXT,
454 @ mimetype TEXT,
455 @ icomment TEXT
456 @ );
457 @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);
 
 
 
 
 
 
 
 
 
458 ;
 
459
460 /*
461 ** Predefined tagid values
462 */
463 #if INTERFACE
464
--- src/schema.c
+++ src/schema.c
@@ -45,11 +45,11 @@
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 "2017-01-10"
51 /* NB: Some features require the latest schema. Warning or error messages
52 ** will appear if an older schema is used. However, the older schemas are
53 ** adequate for many common functions. */
54
55 #endif /* INTERFACE */
@@ -453,11 +453,21 @@
453 @ username TEXT,
454 @ mimetype TEXT,
455 @ icomment TEXT
456 @ );
457 @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);
458 @
459 @ -- Each remark artifact makes a single entry in the Remark table.
460 @ CREATE TABLE remark(
461 @ rid INTEGER PRIMARY KEY, -- The Remark artifact in the BLOB table
462 @ ctime TIMESTAMP, -- Creation date. Julian day.
463 @ target TEXT, -- UUID for check-in or name of branch
464 @ uid TEXT -- Name of user who entered this remark
465 @ );
466 @ CREATE INDEX remarkidx1 ON remark(target,ctime);
467 ;
468
469
470 /*
471 ** Predefined tagid values
472 */
473 #if INTERFACE
474

Keyboard Shortcuts

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