title: Sequelize upsert() never updates and only inserts
body: <p>So I'm trying to use the <code>model.upsert()</code> of <code>sequelize</code> and all i receive is inserts , no matter what i change in the query.</p>
  
  <p>I have a Transaction model that has some fields, with the default generated id.</p>
  
  <p>reading the sequelize's <code>upsert</code> documentation i noticed this:</p>
  
  <blockquote>
    <p>An update will be executed if a row which matches the supplied values on either the primary key or a unique key is found. Note that the unique index must be defined in your sequelize model and not just in the table.</p>
  </blockquote>
  
  <p>So i was guessing i have to define the <code>id</code> of the Transaction in the model definition, and so i did with no luck as it still only creates new entries..</p>
  
  <pre><code>TransactionModel = {
      id: {
          type: Sequelize.INTEGER,
          allowNull: false,
          primaryKey: true,
          autoIncrement: true
      },
      {.......}
  }
  </code></pre>
  
  <p>What am i doing wrong, what did i miss?</p>
  
  <p>Any explanation and solution will be highly appreciated, thanks in advance!</p>
  
  <h2>EDIT:</h2>
  
  <p>This is the upsert code: </p>
  
  <pre><code>createOrUpdateTransaction: {
              type: Transaction,
              args: {
                  payerAccountNumber: {type: new GraphQLNonNull(GraphQLInt)},
                  recipientAccountNumber: {type: new GraphQLNonNull(GraphQLInt)},
                  amount: {type: new GraphQLNonNull(GraphQLFloat)},
                  currency: {type: new GraphQLNonNull(GraphQLString)},
                  paymentMethod: {type: new GraphQLNonNull(GraphQLString)},
                  cardNumber: {type: GraphQLFloat},
                  cardName: {type: GraphQLString},
                  cardNetwork: {type: GraphQLString},
                  cashMachineId: {type: GraphQLFloat},
                  receiptNumber: {type: new GraphQLNonNull(GraphQLFloat)},
                  invoiceNumber: {type: new GraphQLNonNull(GraphQLFloat)},
                  receiptCopy: {type: new GraphQLNonNull(GraphQLString)},
                  description: {type: GraphQLString},
                  bankDescription: {type: GraphQLString},
                  bankReference: {type: new GraphQLNonNull(GraphQLString)},
                  bankSubCurrencyAccount: {type: new GraphQLNonNull(GraphQLString)},
                  tags: {type: new GraphQLList(GraphQLString)},
                  notes: {type: GraphQLString}
              },
              resolve: (root, args) =&gt; {
                  return db.models.transaction.upsert({
                      time: new Date().toString(),
                      payerAccountNumber: args.payerAccountNumber,
                      recipientAccountNumber: args.recipientAccountNumber,
                      amount: args.amount,
                      currency: args.currency,
                      paymentMethod: args.paymentMethod,
                      cardNumber: args.cardNumber,
                      cardName: args.cardName,
                      cardNetwork: args.cardNetwork,
                      cashMachineId: args.cashMachineId,
                      receiptNumber: args.receiptNumber,
                      invoiceNumber: args.invoiceNumber,
                      receiptCopy: args.receiptCopy,
                      description: args.description,
                      bankDescription: args.bankDescription,
                      bankReference: args.bankReference,
                      bankSubCurrencyAccount: args.bankSubCurrencyAccount,
                      tags: args.tags,
                      notes: args.notes,
                      bankAccountAccountNumber: args.payerAccountNumber
                  })
              }
          }
  </code></pre>
  
  <p>As this is part of a <code>Mutation</code> in <code>GraphQL</code>.</p>
  
  <p>It might be worth noting that this was <code>addTransaction</code> before and all i changed was to <code>db.models.transaction.upsert()</code> from <code>db.models.transaction.create()</code></p>