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

Diesel cli generates invalid joinable!() when using postgres schema #1171

Closed
antab opened this Issue Sep 16, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@antab
Contributor

antab commented Sep 16, 2017

Using the following SQL:

CREATE SCHEMA test;
CREATE TABLE test.a(
        id serial NOT NULL,
        CONSTRAINT a_pkey PRIMARY KEY (id)

);
CREATE TABLE test.b(
        id serial NOT NULL,
        parent serial NOT NULL,
        CONSTRAINT b_pkey PRIMARY KEY (id)

);
ALTER TABLE test.b ADD CONSTRAINT ab_fkey FOREIGN KEY (parent)
REFERENCES test.a (id) MATCH FULL
ON DELETE NO ACTION ON UPDATE NO ACTION;

Then diesel print-schema --schema test --database-url postgresql://... will then output:

pub mod test {
    table! {
        test.a (id) {
            id -> Int4,
        }
    }

    table! {
        test.b (id) {
            id -> Int4,
            parent -> Int4,
        }
    }

    joinable!(test.b -> test.a (parent));
}

This won't compile and removing test. from the joinable!() fixes the issue.

antab added a commit to antab/diesel that referenced this issue Sep 16, 2017

antab added a commit to antab/diesel that referenced this issue Sep 16, 2017

antab added a commit to antab/diesel that referenced this issue Sep 17, 2017

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