Skip to content

Could we add support for the MySQL/MariaDB SET data type? #2779

@AlliterativeAlice

Description

@AlliterativeAlice

Issue type:

[ ] question
[ ] bug report
[x] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Along with the ENUM data type, MySQL and MariaDB (and possibly other database systems) have a SET data type. It works like ENUM but allows for the column to hold multiple values. Could we add support for this data type to TypeORM?

Creating a column with a SET datatype could look like this:

enum Role {
  Admin = "Admin",
  Support = "Support",
  Developer = "Developer"
}

@Entity()
export class User {

    @PrimaryGeneratedColumn()
    id: number;

    @Column('set', { enum: Role })
    roles: Role[];
}

We can accomplish something similar with the simple array type, but having support for SET would be nice.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions