drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Support Timestamp-After-Column Validation in Drizzle Seed

Open
#5,080 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Feature hasn't been suggested before.

- [x] I have verified this feature I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

When seeding my database, I want to ensure that the `expiresAt` timestamp is later than `createdAt`. I have not found a way to enforce this using `refine`. If it is possible, it would be helpful for the documentation to include a more explicit example; if it is not, it would be worthwhile to consider adding support for it.

```js
async function main() {
await reset(db, { licenses });
await seed(db, { licenses }, { count: 50 }).refine((func) => ({
licenses: {
columns: {
// Something like this...
expiresAt: func.timestamp(licenses.createdAt, { add: { days: 30 } }),
},
},
}));
await db.$client.end();
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.