PHP Classes

File: sql/mysql/00-local.sql

Recommend this page to a friend!
  Classes of Scott Arciszewski   Chronicle   sql/mysql/00-local.sql   Download  
File: sql/mysql/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
Resolve publish issues in MySQL
Fix constraints issue for MySQL 5.6
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: 970 bytes
 

Contents

Class file image Download
CREATE TABLE chronicle_clients ( `id` BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, `publicid` VARCHAR(128) NOT NULL, `publickey` TEXT NOT NULL, `isAdmin` BOOLEAN NOT NULL DEFAULT FALSE, `comment` TEXT, `created` DATETIME DEFAULT CURRENT_TIMESTAMP, `modified` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE NOW() ); CREATE INDEX chronicle_clients_clientid_idx ON chronicle_clients(`publicid`); CREATE TABLE chronicle_chain ( `id` BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, `data` TEXT NOT NULL, `prevhash` VARCHAR(128) NULL, `currhash` VARCHAR(128) NOT NULL, `hashstate` TEXT NOT NULL, `summaryhash` VARCHAR(128) NOT NULL, `publickey` TEXT NOT NULL, `signature` TEXT NOT NULL, `created` DATETIME DEFAULT CURRENT_TIMESTAMP, INDEX(`prevhash`), INDEX(`currhash`), INDEX(`summaryhash`), FOREIGN KEY (`prevhash`) REFERENCES chronicle_chain(`currhash`) ON DELETE RESTRICT ON UPDATE RESTRICT, UNIQUE(`prevhash`), UNIQUE(`currhash`) );