K
Kysely9mo ago
ohmi

Creating an 'enum' type column

Hi all, Trying to re-create this MySQL in Kysely
...
CREATE TABLE ...(
...
members ENUM('female','male','coed') NOT NULL
...
CREATE TABLE ...(
...
members ENUM('female','male','coed') NOT NULL
await trx.schema
.createTable("expected_available_songs")
....
.addColumn("members", "", (x) => x.notNull())
await trx.schema
.createTable("expected_available_songs")
....
.addColumn("members", "", (x) => x.notNull())
but not quite sure what type to use (or escape hatches) to generate an ENUM here
Solution:
Like this: ```ts await trx.schema .createTable("expected_available_songs")...
Jump to solution
1 Reply
Solution
koskimas
koskimas9mo ago
Like this:
await trx.schema
.createTable("expected_available_songs")
....
.addColumn("members", sql`ENUM('female','male','coed')`, (x) => x.notNull())
await trx.schema
.createTable("expected_available_songs")
....
.addColumn("members", sql`ENUM('female','male','coed')`, (x) => x.notNull())
Want results from more Discord servers?
Add your server