PHP Classes

File: sql/sqlite/00-local.sql

Recommend this page to a friend!
  Classes of Scott Arciszewski   Chronicle   sql/sqlite/00-local.sql   Download  
File: sql/sqlite/00-local.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Chronicle
Append arbitrary data to a storage container
Author: By
Last change: Fix all database issues
Add foreign key / unique constraints.
Future Genesis blocks will have a NULL prevhash, thereby allowing UNIQUE
FOREIGN KEY constraints to be created on prevhash pointing to a previous
row's currahsh.
Date: 1 year ago
Size: 1,154 bytes
 

Contents

Class file image Download
CREATE TABLE chronicle_clients ( id INTEGER PRIMARY KEY ASC AUTOINCREMENT, publicid TEXT NOT NULL, publickey TEXT NOT NULL, isAdmin INTEGER NOT NULL DEFAULT 0, comment TEXT, created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE INDEX chronicle_clients_clientid_idx ON chronicle_clients(publicid); CREATE INDEX chronicle_clients_publickey_idx ON chronicle_clients(publickey); CREATE TABLE chronicle_chain ( id INTEGER PRIMARY KEY ASC AUTOINCREMENT, data TEXT NOT NULL, prevhash TEXT NULL, currhash TEXT NOT NULL, hashstate TEXT NOT NULL, summaryhash TEXT NOT NULL, publickey TEXT NOT NULL, signature TEXT NOT NULL, created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (prevhash) REFERENCES chronicle_chain(currhash), FOREIGN KEY (publickey) REFERENCES chronicle_clients(publickey), UNIQUE(prevhash), UNIQUE(currhash), UNIQUE(signature) ); CREATE INDEX chronicle_chain_prevhash_idx ON chronicle_chain(prevhash); CREATE INDEX chronicle_chain_currhash_idx ON chronicle_chain(currhash); CREATE INDEX chronicle_chain_summaryhash_idx ON chronicle_chain(summaryhash);