Fossil

Check-in [f051f1d3]
Login

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

Overview
Comment:Schema enhancements necessary to support the Remark artifact.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | remarks-on-checkins
Files: files | file ages | folders
SHA1: f051f1d3d11f8bd0513325dad5eb1dcfc33b9815
User & Date: drh 2017-01-10 20:38:43.031
Context
2017-01-10
20:38
Schema enhancements necessary to support the Remark artifact. ... (Closed-Leaf check-in: f051f1d3 user: drh tags: remarks-on-checkins)
20:32
Improvements to comments and file format docs. ... (check-in: f0c19ea1 user: mistachkin tags: remarks-on-checkins)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
1496
1497
1498
1499
1500
1501
1502














1503
1504
1505
1506
1507
1508
1509
    db_begin_transaction();
    db_multi_exec(
      "ALTER TABLE repository.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
      "ALTER TABLE repository.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;"
    );
    db_end_transaction(0);
  }














}

/*
** Flags for the db_find_and_open_repository() function.
*/
#if INTERFACE
#define OPEN_OK_NOT_FOUND    0x001      /* Do not error out if not found */







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







1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
    db_begin_transaction();
    db_multi_exec(
      "ALTER TABLE repository.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
      "ALTER TABLE repository.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;"
    );
    db_end_transaction(0);
  }

  /* Verify that the REMARK table exists.  It was added on 2017-01-10.
  */
  if( !db_table_exists("repository","remark") ){
    db_multi_exec(
      "CREATE TABLE repository.remark(\n"
      "  rid INTEGER PRIMARY KEY,\n" /* The Remark artifact in BLOB table */
      "  ctime TIMESTAMP,\n"         /* Creation date.  Julian day. */
      "  target TEXT,\n"             /* UUID for check-in or name of branch */
      "  uid TEXT\n"                 /* Name of user who entered remark */
      ");\n"
      "CREATE INDEX repository.remarkidx1 ON remark(target,ctime);"
    );
  }
}

/*
** Flags for the db_find_and_open_repository() function.
*/
#if INTERFACE
#define OPEN_OK_NOT_FOUND    0x001      /* Do not error out if not found */
Changes to src/manifest.c.
2400
2401
2402
2403
2404
2405
2406





2407
2408
2409
2410
2411
2412
2413
    db_multi_exec(
      "REPLACE INTO event(type,mtime,objid,user,comment)"
      "VALUES('g',%.17g,%d,%Q,%Q)",
      p->rDate, rid, p->zUser, blob_str(&comment)+1
    );
    blob_reset(&comment);
  }





  db_end_transaction(0);
  if( permitHooks ){
    rc = xfer_run_common_script();
    if( rc==TH_OK ){
      rc = xfer_run_script(zScript, zUuid, 0);
    }
  }







>
>
>
>
>







2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
    db_multi_exec(
      "REPLACE INTO event(type,mtime,objid,user,comment)"
      "VALUES('g',%.17g,%d,%Q,%Q)",
      p->rDate, rid, p->zUser, blob_str(&comment)+1
    );
    blob_reset(&comment);
  }
  if( p->type==CFTYPE_REMARK ){
    db_multi_exec(
      "INSERT OR IGNORE INTO remark(rid,target,ctime,uid)"
      "VALUES(%d,%Q,%.17g,%Q)", p->rid, p->zRemTarget, p->rDate, p->zUser);
  }
  db_end_transaction(0);
  if( permitHooks ){
    rc = xfer_run_common_script();
    if( rc==TH_OK ){
      rc = xfer_run_script(zScript, zUuid, 0);
    }
  }
Changes to src/schema.c.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
** changes.  The aux tables have an arbitrary version number (typically
** a date) which can change frequently.  When the content schema changes,
** we have to execute special procedures to update the schema.  When
** the aux schema changes, all we need to do is rebuild the database.
*/
#define CONTENT_SCHEMA  "2"
#define AUX_SCHEMA_MIN  "2011-04-25 19:50"
#define AUX_SCHEMA_MAX  "2015-01-24"
/* NB:  Some features require the latest schema.  Warning or error messages
** will appear if an older schema is used.  However, the older schemas are
** adequate for many common functions. */

#endif /* INTERFACE */









|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
** changes.  The aux tables have an arbitrary version number (typically
** a date) which can change frequently.  When the content schema changes,
** we have to execute special procedures to update the schema.  When
** the aux schema changes, all we need to do is rebuild the database.
*/
#define CONTENT_SCHEMA  "2"
#define AUX_SCHEMA_MIN  "2011-04-25 19:50"
#define AUX_SCHEMA_MAX  "2017-01-10"
/* NB:  Some features require the latest schema.  Warning or error messages
** will appear if an older schema is used.  However, the older schemas are
** adequate for many common functions. */

#endif /* INTERFACE */


451
452
453
454
455
456
457









458

459
460
461
462
463
464
465
@   -- Add as many fields as required below this line
@   login TEXT,
@   username TEXT,
@   mimetype TEXT,
@   icomment TEXT
@ );
@ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);









;


/*
** Predefined tagid values
*/
#if INTERFACE
# define TAG_BGCOLOR    1     /* Set the background color for display */
# define TAG_COMMENT    2     /* The check-in comment */







>
>
>
>
>
>
>
>
>

>







451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
@   -- Add as many fields as required below this line
@   login TEXT,
@   username TEXT,
@   mimetype TEXT,
@   icomment TEXT
@ );
@ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);
@
@ -- Each remark artifact makes a single entry in the Remark table.
@ CREATE TABLE remark(
@   rid INTEGER PRIMARY KEY, -- The Remark artifact in the BLOB table
@   ctime TIMESTAMP,         -- Creation date.  Julian day.
@   target TEXT,             -- UUID for check-in or name of branch
@   uid TEXT                 -- Name of user who entered this remark
@ );
@ CREATE INDEX remarkidx1 ON remark(target,ctime);
;


/*
** Predefined tagid values
*/
#if INTERFACE
# define TAG_BGCOLOR    1     /* Set the background color for display */
# define TAG_COMMENT    2     /* The check-in comment */