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

Implement Unsigned<Tinyint> for MySql #1771

Closed
RazrFalcon opened this Issue Jul 2, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@RazrFalcon

RazrFalcon commented Jul 2, 2018

Setup

Versions

  • Diesel: 1.3.2

Feature Flags

  • Diesel: mysql

Problem Description

Looks like diesel::mysql::types::Unsigned is not implemented for u8, aka Tinyint.

What are you trying to accomplish?

Use the TINYINT type.

What is the actual output?

error[E0277]: the trait bound `u8: diesel::Queryable<diesel::sql_types::Unsigned<diesel::sql_types::Tinyint>, diesel::mysql::Mysql>` is not satisfied

Steps to reproduce

Use this SQL to generate the schema

CREATE TABLE test (
    id INT,
    score TINYINT UNSIGNED
)
table! {
    test (id) {
        id -> Integer,
        score -> Nullable<Unsigned<Tinyint>>,
    }
}

and try to query it:

#[derive(Queryable)]
pub struct Test {
    pub id: i32,
    pub score: Option<u8>,
}

Checklist

  • I have already looked over the issue tracker for similar issues.
  • This issue can be reproduced on Rust's stable channel. (Your issue will be
    closed if this is not the case)
@sgrif

This comment has been minimized.

Member

sgrif commented Jul 4, 2018

For the record, SMALLINT is not the same as TINYINT but there does appear to be a legitimate omission here.

@RazrFalcon

This comment has been minimized.

RazrFalcon commented Jul 5, 2018

Yes. I've mistaken. Updated the post.

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