1 DROP TABLE IF EXISTS references;
2 CREATE TABLE references (
3 id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
4 ,`type` ENUM( 'hash', 'array' ) NOT NULL DEFAULT 'hash'
5 ,refcount BIGINT UNSIGNED NOT NULL DEFAULT 1
8 DROP TABLE IF EXISTS datas;
10 id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
11 ,reference_id BIGINT UNSIGNED NOT NULL
15 ,FOREIGN KEY (reference_id) REFERENCES references (id)
18 --DROP TABLE IF EXISTS `rec_array`;
19 --CREATE TABLE `rec_array` (
20 -- `id` bigint(20) unsigned NOT NULL,
24 --DROP TABLE IF EXISTS `rec_array_item`;
25 --CREATE TABLE `rec_array_item` (
26 -- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
27 -- `array` bigint(20) NOT NULL,
28 -- `pos` bigint(20) NOT NULL,
29 -- `value_data` varchar(255) DEFAULT NULL,
30 -- `value_type` enum('array','data','hash','text','value') NOT NULL DEFAULT 'value',
31 -- PRIMARY KEY (`id`),
32 -- UNIQUE KEY `array_2` (`array`,`pos`)
35 --DROP TABLE IF EXISTS `rec_hash`;
36 --CREATE TABLE `rec_hash` (
37 -- `id` bigint(20) unsigned NOT NULL,
41 --DROP TABLE IF EXISTS `rec_hash_item`;
42 --CREATE TABLE `rec_hash_item` (
43 -- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
44 -- `hash` bigint(20) NOT NULL,
45 -- `key_data` varchar(255) DEFAULT NULL,
46 -- `key_hash` varchar(22) NOT NULL,
47 -- `key_type` enum('text','value') NOT NULL DEFAULT 'value',
48 -- `value_data` varchar(255) DEFAULT NULL,
49 -- `value_type` enum('array','data','hash','text','value') NOT NULL DEFAULT 'value',
50 -- PRIMARY KEY (`id`),
51 -- UNIQUE KEY `hash_2` (`hash`,`key_hash`)
54 --DROP TABLE IF EXISTS `rec_item`;
55 --CREATE TABLE `rec_item` (
56 -- `id` bigint(20) NOT NULL AUTO_INCREMENT,
57 -- `item_type` enum('array','hash') NOT NULL DEFAULT 'hash',
61 --DROP TABLE IF EXISTS `rec_value_data`;
62 --CREATE TABLE `rec_value_data` (
63 -- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
64 -- `data` longblob NOT NULL,
68 --DROP TABLE IF EXISTS `rec_value_text`;
69 --CREATE TABLE `rec_value_text` (
70 -- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
71 -- `data` longtext NOT NULL,