Moved a few things and started on the MySQL schema
[dbsrgits/DBM-Deep.git] / etc / mysql_tables.sql
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
6 );
7
8 DROP TABLE IF EXISTS datas;
9 CREATE TABLE data (
10     id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
11    ,reference_id BIGINT UNSIGNED NOT NULL
12    ,key TEXT NOT NULL
13    ,value TEXT
14    ,class TEXT
15    ,FOREIGN KEY (reference_id) REFERENCES references (id)
16 );
17
18 --DROP TABLE IF EXISTS `rec_array`;
19 --CREATE TABLE `rec_array` (
20 --  `id` bigint(20) unsigned NOT NULL,
21 --  PRIMARY KEY (`id`)
22 --);
23 --
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`)
33 --);
34 --
35 --DROP TABLE IF EXISTS `rec_hash`;
36 --CREATE TABLE `rec_hash` (
37 --  `id` bigint(20) unsigned NOT NULL,
38 --  PRIMARY KEY (`id`)
39 --);
40 --
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`)
52 --);
53 --
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',
58 --  PRIMARY KEY (`id`)
59 --);
60 --
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,
65 --  PRIMARY KEY (`id`)
66 --);
67 --
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,
72 --  PRIMARY KEY (`id`)
73 --);
74 --