New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table field defined multiple times #1274

Closed
ghost opened this Issue Oct 25, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@ghost

ghost commented Oct 25, 2017

image

but one table have only one this name 'level'

@ghost

This comment has been minimized.

ghost commented Oct 25, 2017

table! {
level (id) {
id -> Integer,
name -> Varchar,
level -> Tinyint,
limits -> Integer,
limite -> Integer,
}
}

Maybe it's the problem here?

@Eijebong

This comment has been minimized.

Member

Eijebong commented Oct 25, 2017

Yeah you can't have a column with the same name as the table. You can rename the column by putting a #[sql_name="level"] on it and renaming it to level_ or whatever other name you can think about. http://docs.diesel.rs/diesel/macro.table.html

@ghost

This comment has been minimized.

ghost commented Oct 25, 2017

can't both use infer_schema!("dotenv:DATABASE_URL") and table! ?

@Eijebong

This comment has been minimized.

Member

Eijebong commented Oct 25, 2017

No, you can't blacklist tables from infer_schema! so you have to do everything with table!. diesel print-schema will help you do that :p

@sgrif

This comment has been minimized.

Member

sgrif commented Oct 27, 2017

You could also use infer_table_from_schema! for the tables that you want to infer. Closing as there doesn't appear to be anything actionable here, but feel free to ask further questions here or in gitter.

@sgrif sgrif closed this Oct 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment