drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Support SET Type in MySQL with mysqlSet
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
Add support for the SET type in the same manor as `mysqlEnum`, should be created the same way, example schema:
```ts
export const blogPostsTable = mysqlTable("posts", {
title: varchar("title", { length: 255 }).notNull().primaryKey(),
content: text("content").notNull(),
slug: varchar("slug", { length: 255 }).notNull(),
tags: mysqlSet("tags", ["javascript", "typescript", "react", "vue", "nextjs", "nuxt", "angular"]).notNull()
});
```
MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/set.html
Query
```ts
const posts: Post[] = await db
.select()
.from(blogPostsTable)
.where(findInSet(blogPostsTable.tags, ["react", "nextjs"]));
```
```sql
SELECT * FROM posts WHERE FIND_IN_SET('react,nextjs',tags);
```
Contributor guide
Assessment
This issue has not been assessed yet.