[英]Can DBIx::Class be used to create tables?
I do not think I understand the scope of DBIx::Class
我不认为我理解DBIx::Class
的范围
Do I have to manually create a database with regular SQL first, then use the schemaloader (or manually code the schema/resultsets)? 我是否必须首先使用常规SQL手动创建数据库,然后使用模式加载器(或手动编写模式/结果集)?
Or is there a way to tell DBIx::Class
to go ahead and create the tables from a manually coded schema and resultset? 或者有没有办法告诉DBIx::Class
继续从手动编码的模式和结果集创建表?
I ask b/c if I need to create the database via SQL CREATE TABLE
statement, I have the column essentially duplicated in the ResultSet code, OR I need to rely on schemaloader which I assume is inefficient and inappropriate for production. 我问b / c我是否需要通过SQL CREATE TABLE
语句创建数据库,我在ResultSet代码中基本上复制了这个列,或者我需要依赖于schemaloader,我认为这是低效且不适合生产的。
You can go either route. 你可以去任何一条路线。 You can create a schema and get DBIx::Class to analyse it , or you can get DBIx::Class to build the schema to you . 您可以创建一个模式并获取DBIx :: Class来分析它 ,或者您可以让DBIx :: Class为您构建模式 。
The former does not have to be inefficient for production, since you can get DBIx::Class to save the generated code so that it doesn't have to do the analysis every run. 前者不一定非常低效,因为您可以使用DBIx :: Class来保存生成的代码,这样就不必每次运行都进行分析。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.