can't push changes to SQLite database

Hey folks I had the following schema
import { createId as cuid } from "@paralleldrive/cuid2";
import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
import { relations, sql } from "drizzle-orm";
import { customType, index, integer, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";

...

export const sessions = sqliteTable(
  "sessions",
  {
    id: text()
      .notNull()
      .primaryKey()
      .$defaultFn(() => cuid()),
    userId: text("user_id")
      .notNull()
      .references(() => users.id, { onDelete: "cascade" }),
    userAgent: text("user_agent"),
    ipAddress: text("ip_address"),
    createdAt: dateTime("created_at")
      .notNull()
      .default(sql`(CURRENT_TIMESTAMP)`),
    updatedAt: dateTime("updated_at")
      .notNull()
      .$defaultFn(() => new Date()),
    expiresAt: dateTime("expires_at").notNull(),
  },
  (session) => [index("session_userId_idx").on(session.userId)],
);

I added new field to this schema which is token: text().notNull().unique() but after this when I run
drizzle-kit push
It gives the following error
$ drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file 'D:\Warbler\drizzle.config.ts'
[✓] Pulling schema from database...
LibsqlError: SQLITE_ERROR: no such index: sessions_token_unique
Was this page helpful?