No Such Index w/ .unqiue() Constrain

Hello!

I am running into a issue using sqlite / turso where when applying a .unique() constraint and running db:push it is giving the following error:

  code: 'SQLITE_UNKNOWN',
  rawCode: undefined,
  [cause]: [ResponseError: SQLite error: no such index: contacts_unsubscribeToken_unique] {
    code: 'SQLITE_UNKNOWN',
    proto: {
      message: 'SQLite error: no such index: contacts_unsubscribeToken_unique',
      code: 'SQLITE_UNKNOWN'
    }
  }


This is the table:

export const contacts = sqliteTable("contacts", (t) => ({
    email: t.text().primaryKey(),
    name: t.text().notNull(),
    unsubscribeToken: t.text().notNull().unique(),
    createdAt: t.integer({ mode: "timestamp" }).default(sql`CURRENT_TIMESTAMP`),
    canEmail: t.integer({ mode: "boolean" }).notNull().default(true),
}));


Thank you in advance for the help!
Was this page helpful?