Mads
Mads
Explore posts from servers
DTDrizzle Team
Created by Mads on 8/31/2024 in #help
notNull and Unique
Hi Whenever I use push:db I get that I am about to add a new unique constraint. I then checked and I don’t actually have the unique constraints set. Am I doing something wrong?
export const companies = mysqlTable('companies', {
id: int('id').autoincrement().primaryKey(),
name: varchar('name', { length: 255 }).unique().notNull(),
owner_id: varchar('owner_id', { length: 255 }).notNull().references(() => users.id),
has_finished_introduction: boolean('has_finished_introduction').default(false).notNull(),
created_at: datetime('created_at').default(sql`CURRENT_TIMESTAMP`).notNull(),
updated_at: datetime('updated_at').default(sql`CURRENT_TIMESTAMP`).notNull(),
})
export const companies = mysqlTable('companies', {
id: int('id').autoincrement().primaryKey(),
name: varchar('name', { length: 255 }).unique().notNull(),
owner_id: varchar('owner_id', { length: 255 }).notNull().references(() => users.id),
has_finished_introduction: boolean('has_finished_introduction').default(false).notNull(),
created_at: datetime('created_at').default(sql`CURRENT_TIMESTAMP`).notNull(),
updated_at: datetime('updated_at').default(sql`CURRENT_TIMESTAMP`).notNull(),
})
"drizzle-kit": "^0.24.2",
7 replies