【发布时间】:2022-01-23 01:16:50
【问题描述】:
当我使用此命令生成模型时,使用diesel_ext:
diesel_ext --schema-file src/model/diesel/dolphin/dolphin_schema.rs --model
它显示如下错误:
error: Column `article_content` cannot be named the same as its table.
You may use `#[sql_name = "article_content"]` to reference the table's `article_content` column.
See the documentation of the `table!` macro for details`
--> src/model/diesel/dolphin/dolphin_schema.rs:37:1
|
37 | / table! {
38 | | article_content (id) {
39 | | id -> Int8,
40 | | article_id -> Int8,
41 | | article_content -> Varchar,
42 | | }
43 | | }
| |_^
|
= note: this error originates in the macro `__static_cond` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `reddwarf-admin` due to previous error
我应该如何配置在列前添加#[sql_name = "article_content"] 注释?我无法从文档中找到任何提示。我试图添加这样的评论:
table! {
article_content (id) {
id -> Int8,
article_id -> Int8,
#[sql_name = "article_content"]
article_content -> Varchar,
}
}
仍然没有解决这个问题。
【问题讨论】:
标签: rust rust-cargo rust-diesel