drizzle-team / drizzle-team/drizzle-orm
[BUG]:Object literal may only specify known properties nest js
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [X] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.38.3
### What version of `drizzle-kit` are you using?
0.30.1
### Other packages
_No response_
### Describe the Bug
Im using nest js:
error:
**Object literal may only specify known properties, and 'otp' does not exist in type**
My pgTable Schema
```
import {
pgTable,
varchar,
integer,
timestamp,
date,
jsonb,
boolean,
} from 'drizzle-orm/pg-core';
import { rolesTable } from './roles.schema';
export const usersTable = pgTable('users', {
id: integer().primaryKey().generatedByDefaultAsIdentity(),
firstName: varchar({ length: 100 }).notNull(),
lastName: varchar({ length: 100 }).notNull(),
email: varchar({ length: 255 }).notNull().unique(),
password: varchar('password').notNull(),
dateOfBirth: date('dateOfBirth'), // yyyy-mm-dd
otp: varchar({ length: 6 }), // Stores the OTP
otpExpiresAt: timestamp('otpExpiresAt'), // Expiry timestamp
isGoogleLogin: boolean('isGoogleLogin').default(false),
isMicrosoftLogin: boolean('isMicrosoftLogin').default(false),
isInstagramLogin: boolean('isInstagramLogin').default(false),
loginCount: integer('loginCount').default(0), // Track user logins
lastLoginAt: date('lastLoginAt'), // Store last login time
lastLoginDevice: jsonb('lastLoginDevice'), // Store device info (e.g., deviceId, OS, etc.)
pushToken: varchar('pushToken'), // Store push token for notifications
isLoggedInOnMultipleDevices: boolean('isLoggedInOnMultipleDevices').default(
false,
), // Track login on multiple devices
roleId: integer()
.notNull()
.references(() => rolesTable.id),
});
```
My code of db
```
// Generate OTP and expiry
const otp = Math.floor(100000 + Math.random() * 900000).toString();
const otpExpiresAt = new Date(Date.now() + 15 * 60 * 1000); // 15 minutes
const result = await this.databaseService
.getDb()
.insert(usersTable)
.values({
roleId,
firstName,
lastName,
email,
password: password,
otp,
otpExpiresAt,
});
```
Packages:
"drizzle-orm": "^0.38.3",
"pg": "^8.13.1",
"drizzle-kit": "^0.30.1",
"tsx": "^4.19.2",
"typescript": "^5.1.3"
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.3.0",
"@nestjs/core": "^10.0.0",
Contributor guide
Assessment
This issue has not been assessed yet.