简体   繁体   English

亚音速DB模式生成

[英]Subsonic DB Schema Generation

I was watching subsonic's simple repository demo. 我正在观看subsonic的简单存储库演示。 I came to know that DB schema can be generated from code. 我知道可以从代码生成数据库模式。 I think of code generation as usually domain layer from database. 我认为代码生成通常是数据库的域层。 Where is this useful? 这在哪里有用?

The simple repository generates a database from DTO objects and in contrast if you use the ActiveRecord templates the data layer is generated from an existing db. 简单的存储库从DTO对象生成数据库,相反,如果您使用ActiveRecord模板,则数据层是从现有数据库生成的。

For small or new projects with little changes to the database the simple repository is fine but for a larger DB or if you start to migrate an existing project with a grown DB to subsonic you would probably be happier with ActiveRecord. 对于小型或新的项目,对数据库的更改很少,简单的存储库就可以了,但是对于较大的数据库,或者如果您开始将具有成长数据库的现有项目迁移到亚音速,那么ActiveRecord可能会更好。

I would recommend using the ActiveRecord approach and additionally use the migration tool from subsonic 2 for further changes to the DB (it can be used independently from subsonic 2 since it's a standalone tool). 我建议使用ActiveRecord方法,并另外使用subsonic 2的迁移工具对数据库进行进一步更改(由于它是独立工具,因此可以独立于subsonic 2使用)。

Defining SubSonic 3 ActiveRecord migrations 定义SubSonic 3 ActiveRecord迁移

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM