开发者

Automatic database schema generation and migration with Perl

开发者 https://www.devze.com 2022-12-27 19:14 出处:网络
In Ror or Django or web2py you can \"describe\" a database (as a set of classes that remaps to tables) and the framework (having being provided with a connection string to the desired database) genera

In Ror or Django or web2py you can "describe" a database (as a set of classes that remaps to tables) and the framework (having being provided with a connection string to the desired database) generates the tables, fields, relations and in the case of RoR and web2py it also keeps it up-to-date (eg, removing a class drops the table, adding a property to the class triggers an开发者_如何学Python "alter table add" etc).

Is there any Perl module that does the same? Eg, it takes the YAML/XML/JSON description of a database as input and modifies/generates the database schema accordingly?


Yes, the module is SQL::Translator::Parser::YAML, and here is some documentation


I have an alpha version GPL project that does this. Though it is written in PHP, it can be invoked from Perl:

System("/path/to/triBuilder.php --yaml=....");

http://code.google.com/p/triangulum-db/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号