Hi everybody,

last week some friends started to think about a viable solution to implement a SssS infrastructure to develop our applications on and give the final users the power to customize every aspect of the application (objects, properties, relations, processes and workflows) ... One of the options we were thinking to develop (and opensource it) is an idea that was based on mysql's information_schema (well kind of) and "reverse engineering" on SalesForce.com, and it's something like this:

CREATE TABLE `OBJECTS` (
  `OBJECT_ID` int(20) NOT NULL,
  `OBJECT_TABLE` varchar(200) NOT NULL,
  `OBJECT_SINGULAR_NAME` varchar(200) NOT NULL,
  `OBJECT_PLURAL_NAME` varchar(200) NOT NULL,
  `OBJECT_DESCRIPTION` text NOT NULL,
  `OBJECT_CUSTOMIZABLE` tinyint(1) NOT NULL,
  `OBJECT_CREATED_BY` int(20) NOT NULL,
  `OBJECT_CREATED_ON` datetime NOT NULL default '0000-00-00 00:00:00',
  `OBJECT_MODIFIED_BY` int(20) NOT NULL,
  `OBJECT_MODIFIED_ON` datetime NOT NULL default '0000-00-00 00:00:00',
  `OBJECT_REMOVED_BY` int(20) NOT NULL,
  `OBJECT_REMOVED_ON` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`OBJECT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_PROPERTIES` (
  `OBJECT_ID` int(20) NOT NULL,
  `OBJECT_PROPERTY_ID` int(20) NOT NULL,
  `OBJECT_PROPERTY_COLUMN` varchar(200) NOT NULL,
  `OBJECT_PROPERTY_SINGULAR_NAME` varchar(200) NOT NULL,
  `OBJECT_PROPERTY_PLURAL_NAME` varchar(200) NOT NULL,
  `OBJECT_PROPERTY_DESCRIPTION` text NOT NULL,
  `OBJECT_PROPERTY_DATA_TYPE` varchar(20) NOT NULL,
  `OBJECT_PROPERTY_DATA_LENGTH` varchar(20) NOT NULL,
  `OBJECT_PROPERTY_DATA_PRECISION` varchar(20) NOT NULL,
  `OBJECT_PROPERTY_DATA_VALUE` varchar(20) NOT NULL,
  `OBJECT_PROPERTY_CUSTOMIZABLE` tinyint(1) NOT NULL,
  `OBJECT_PROPERTY_NULLABLE` tinyint(1) NOT NULL,
  `OBJECT_PROPERTY_POSITION` int(20) NOT NULL,
  `OBJECT_PROPERTY_CREATED_BY` int(20) NOT NULL,
`OBJECT_PROPERTY_CREATED_ON` datetime NOT NULL default '0000-00-00 00:00:00',
  `OBJECT_PROPERTY_MODIFIED_BY` int(20) NOT NULL,
`OBJECT_PROPERTY_MODIFIED_ON` datetime NOT NULL default '0000-00-00 00:00:00',
  `OBJECT_PROPERTY_REMOVED_BY` int(20) NOT NULL,
  `OBJECT_PROPERTY_REMOVED_ON` datetime NOT NULL default '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_RELATIONS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_TRIGGERS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_PROPERTIES_VALIDATIONS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_RELATIONS_VALIDATIONS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_PERMISSIONS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_PROPERTIES_PERMISSIONS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

CREATE TABLE `OBJECTS_RELATIONS_PERMISSIONS` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

And when I a user customizes, the system would record the metadata regarding the customization, for example let's add a person object, the system would insert a row in OBJECTS table with the following query:

INSERT INTO `OBJECTS` VALUES ('1','TB00001','Person','People','This object represents a real person','1','1','2008-10-01 00:00:00','0','0000-00-00 00:00:00','1','0000-00-00 00:00:00');

And right after that:

CREATE TABLE `TB00001` (
) ENGINE=InnoDB DEFAULT CHARSET=Utf8;

And the next step woudl be to add some properties to the next object

INSERT INTO `OBJECTS` VALUES ('1','1','CL0000100001','ID','ID','Auto increment identification','INTEGER','20','0','NULL','AUTO_INCREMENT()','0','0','1','1','2008-10-01 00:00:00','0','0000-00-00 00:00:00','1','0000-00-00 00:00:00'); INSERT INTO `OBJECTS` VALUES ('1','2','CL0000100002','Nick name','Nick names','The nick of a person','VARCHAR','20','0','','','0','0','2','1','2008-10-01 00:00:00','0','0000-00-00 00:00:00','1','0000-00-00 00:00:00'); INSERT INTO `OBJECTS` VALUES ('1','3','CL0000100003','First name','First names','The name of a person','VARCHAR','200','0','','','0','0','3','1','2008-10-01 00:00:00','0','0000-00-00 00:00:00','1','0000-00-00 00:00:00'); INSERT INTO `OBJECTS` VALUES ('1','4','CL0000100004','Middle name','Middle names','The middle name of a person','VARCHAR','200','0','','','0','0','4','1','2008-10-01 00:00:00','0','0000-00-00 00:00:00','1','0000-00-00 00:00:00'); INSERT INTO `OBJECTS` VALUES ('1','5','CL0000100005','Last name','Last names','The family name of a person','VARCHAR','200','0','','','0','0','5','1','2008-10-01 00:00:00','0','0000-00-00 00:00:00','1','0000-00-00 00:00:00');

What would be followed by (a trigger perheaps or the application it self) the queries:

ALTER TABLE `TB00001` ADD `CL0000100001` INTEGER(20) NOT NULL DEFAULT NULL AUTO_INCREMENT; ALTER TABLE `TB00001` ADD `CL0000100002` VARCHAR(20) NOT NULL DEFAULT '' AFTER `CL0000100001`; ALTER TABLE `TB00001` ADD `CL0000100003` VARCHAR(200) NOT NULL DEFAULT '' AFTER `CL0000100003`; ALTER TABLE `TB00001` ADD `CL0000100004` VARCHAR(200) NOT NULL DEFAULT '' AFTER `CL0000100004`; ALTER TABLE `TB00001` ADD `CL0000100005` VARCHAR(200) NOT NULL DEFAULT '' AFTER `CL0000100005`;

And the same would work for relations, validations, processes and workflows... And the business objects (for example Java, PHP or Python) would be or generated on instantiation or static build when needed.

Anyone even implemented some thing like that? Is there any production experience? Seams that Microsoft Dynamics works like that (but with the metadata description stored in XML). Me and my friends were thingking about going futer with the development... Any one willing to help this little project?

Best Regards,
Bruno B. B. Magalhães
Sócio-Diretor de Negócios e Tecnologia

BLACKBEAN CONSULTORIA
Rua Real Grandeza 193/210, Botafogo
Rio de Janeiro, RJ, 22281-035, Brasil

+55 (21) 9996-1093
+55 (21) 2266-0597
www.blackbean.com.br

Esta mensagem pode conter informação confidencial e/ou privilegiada. Se você não
for o destinatário ou a pessoa autorizada a receber esta mensagem, não pode
usar, copiar ou divulgar as informações nela contidas ou tomar qualquer ação
baseada nessas informações. Se você recebeu esta mensagem por engano, por favor
avise imediatamente o remetente, respondendo o e-mail e em seguida apague-o.
Agradecemos sua cooperação.

This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information
herein. If you have received this message in error, please advise the sender
immediately by reply e-mail and delete this message. Thank you for your
cooperation.






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to