[Home]JaredWilliams

MeatballWiki | RecentChanges | Random Page | Indices | Categories

Hello,

I'm programmer/web developer in the UK. Recently embarked on a writing a wiki from scratch, as part of a learning exercise. Its still in the early stages.

Design

The core of the wiki engine, the versioning, is split into two.

Revision ids are generated by SHA1(parentA, parentB, contentKey).

parentA is the revision id of the content that has just been editted, unless a performing a merge when its one of the revisions to be merged. parentB is only used when merging two forks, otherwise its 20 bytes containing 0.

Current schema is

 CREATE TABLE Revisions
 (
	revision CHAR(20) NOT NULL COLLATE BINARY PRIMARY KEY,
	name VARCHAR(255) NOT NULL,	
	contentKey CHAR(32) NOT NULL COLLATE BINARY,
	timeStamp DATETIME NOT NULL,
	digest TEXT NOT NULL                         -- summary digest
 );

 -- Track parent revision to child revision relations.
 CREATE TABLE Edges
 ( 
	parent CHAR(20) NOT NULL COLLATE BINARY REFERENCES Revisions(revision),
	child CHAR(20) NOT NULL COLLATE BINARY REFERENCES Revisions(revision),
	PRIMARY KEY(parent, child)
 );

To ease the generation of page histories, the transitive closure of the page history graphs are also stored.

 CREATE TABLE Path
 (
	descendant CHAR(20) NOT NULL COLLATE BINARY REFERENCES Revisions(revision),
	ancestor CHAR(20) NOT NULL COLLATE BINARY REFERENCES Revisions(revision),
	distance INTEGER NOT NULL DEFAULT 1,

	PRIMARY KEY(descendant, ancestor)
 );

Allowing retrieval of a page history with one single sql select.

Syntax

Using [Creole]. Current implementation is at [Creole 0.4]. Should guarentee XHTML compliant output.

-- CategoryHomePage


Discussion

MeatballWiki | RecentChanges | Random Page | Indices | Categories
Edit text of this page | View other revisions
Search: