PHP Classes

File: sql/mysql/01-remote.sql

Recommend this page to a friend!
  Classes of Scott Arciszewski   Chronicle   sql/mysql/01-remote.sql   Download  
File: sql/mysql/01-remote.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 foreign key constraint issue for MySQL 5.6 & 5.7
Fix SQL default value issue for MySQL 5.7
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: 1,473 bytes
 

Contents

Class file image Download
CREATE TABLE chronicle_xsign_targets ( `id` BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `clientid` TEXT NOT NULL, `publickey` TEXT NOT NULL, `policy` TEXT NOT NULL, `lastrun` TEXT ); CREATE TABLE chronicle_replication_sources ( `id` BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, `uniqueid` TEXT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `publickey` TEXT NOT NULL ); CREATE TABLE chronicle_replication_chain ( `id` BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, `source` BIGINT UNSIGNED NOT NULL REFERENCES chronicle_replication_sources(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, `data` TEXT NOT NULL, `prevhash` VARCHAR(128) NULL, `currhash` VARCHAR(128) NOT NULL, `hashstate` TEXT NOT NULL, `summaryhash` VARCHAR(128), `publickey` TEXT NOT NULL, `signature` TEXT NOT NULL, `created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `replicated` TIMESTAMP NULL, INDEX(`prevhash`), INDEX(`currhash`), FOREIGN KEY (`prevhash`) REFERENCES chronicle_replication_chain(`currhash`) ON DELETE RESTRICT ON UPDATE RESTRICT, UNIQUE(`source`, `prevhash`) ); CREATE INDEX chronicle_replication_chain_prevhash_idx ON chronicle_replication_chain(`source`, `prevhash`); CREATE INDEX chronicle_replication_chain_currhash_idx ON chronicle_replication_chain(`source`, `currhash`); CREATE INDEX chronicle_replication_chain_summaryhash_idx ON chronicle_replication_chain(`source`, `summaryhash`);