drizzle-kit not detecting tsconfig and getting path alias '~/'

When I try to default to a TS enum, drizzle-kit push fails when i run drizzle-kit push:pg --config=drizzle.config.ts

If I just remove the .default(PDF_PARSE_STATUS.PENDING) in my schema (but keep the import import { PDF_PARSE_STATUS } from '~/types';), it will succeed


Here's my code:

schema.ts
import {
  pgTable,
  text,
  timestamp,
  uuid,
  varchar,
} from 'drizzle-orm/pg-core';

import { PDF_PARSE_STATUS } from '~/types';

export const UserResumeTable = pgTable('user_resumes', {
  id: uuid('id').primaryKey().defaultRandom(),
  filename: text('filename').notNull().unique(),
  content: text('content'),
  status: varchar('status')
    .$type<PDF_PARSE_STATUS>()
    .default(PDF_PARSE_STATUS.PENDING),
  notes: text('notes'),
  createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
});
export const UserResume = UserResumeTable;

export type UserResume = typeof UserResumeTable.$inferSelect;
export type NewUserResume = typeof UserResumeTable.$inferInsert;


types.ts
export enum PDF_PARSE_STATUS {
  SUCCESS = 'SUCCESS',
  FAILED = 'FAILED',
  PENDING = 'PENDING',
}


drizzle.config.ts
import 'dotenv/config';
import type { Config } from 'drizzle-kit';

export default {
  schema: './src/db/schema/index.ts',
  out: './src/db/migrations',
  driver: 'pg',
  dbCredentials: {
    connectionString: process.env.DATABASE_URL!,
  },
} satisfies Config;
Was this page helpful?