Do you think that such data storage thing has a future?
Posted: Fri Jan 06, 2006 2:38 pm
http://nengine.korsengineering.com/file ... nodes.phps
Needed tables:
The idea is to make schema-less data storage that does not require writing any SQL and keeps variable types. Im posting it in design part of the forum, because I'm interested in thoughts on my design.
Needed tables:
Code: Select all
CREATE TABLE attrs (
nodeId int(10) unsigned NOT NULL default '0',
name varchar(30) NOT NULL default '',
type enum('string','integer','float','boolean','null','array','object','text') NOT NULL default 'string',
value mediumtext NOT NULL,
PRIMARY KEY (nodeId,name),
KEY valueIndex (value(30)),
FULLTEXT KEY valueFulltext (value)
);
CREATE TABLE links (
nodeAId int(11) NOT NULL default '0',
relation varchar(30) NOT NULL default '',
nodeBId int(11) NOT NULL default '0',
PRIMARY KEY (nodeAId,relation,nodeBId),
KEY nodeBId (nodeBId,relation)
);
CREATE TABLE nodes (
id int(10) unsigned NOT NULL auto_increment,
kind varchar(30) NOT NULL default '',
alias varchar(30) default NULL,
parent int(11) NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY aliasKEY (kind,alias),
KEY parent (parent)
);