I want to translate below code to kysely, but I can’t figure out how to set minimum to auto increament, and also how to set char length?
CREATE TABLE `users` (
`id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
`last_name` CHAR(50) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
`password` CHAR(50) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1000001
;
I can translate it till here:
await db.schema
.createTable("users")
.addColumn("id", "integer", col => col.primaryKey().unsigned().notNull().autoIncrement())
.addColumn("first_name", "char", col => col.notNull())
.addColumn("last_name", "char", col => col.notNull())
.addColumn("password", "char", col => col.notNull())
.execute();