title: Querying for unique composite fields with Prisma
body: <p>I have an account field in my Postgres DB that has both a username, and an organization that it belongs too. These fields together have to be unique, meaning multiple users can have the same username, but multiple users in the same organization can not have the same username.</p>
  <pre><code>create table account (
      user_id serial primary key,
      username varchar not null,
      password varchar not null,
      is_admin bool not null default false,
      organization_id int not null references organization(organization_id) on delete cascade,
      unique (username, organization_id)
  );
  </code></pre>
  <p>When using Prisma in NodeJs to query the account by username+organization_id to get the exact user I use this query:</p>
  <pre><code>export async function getAccountByUsernameAndOrganization(username, organization_id) {
    return runQuery(
      prisma.account.findOne({
        where: {
          username,
          organization_id,
        },
      }),
    );
  </code></pre>
  <p>However, the query is failing with the messages:</p>
  <blockquote>
  <p>Argument where of type accountWhereUniqueInput needs exactly one
  argument, but you provided username and organization_id. Please choose
  one. Available args:</p>
  </blockquote>
  <pre><code>type accountWhereUniqueInput {
    user_id?: Int
    customer_id?: String
    organization_id?: Int
    account_username_organization_id_key?: Account_username_organization_id_keyCompoundUniqueInput
  }
  </code></pre>
  <blockquote>
  <p>Unknown arg
  'username' in where.username for type accountWhereUniqueInput. Did you
  mean 'user_id'? Available args:</p>
  </blockquote>
  <pre><code>type accountWhereUniqueInput {
    user_id?: Int
    customer_id?: String
    organization_id?: Int
    account_username_organization_id_key?: Account_username_organization_id_keyCompoundUniqueInput
  }
  </code></pre>