irorochad
irorochad
DTDrizzle Team
Created by irorochad on 7/10/2024 in #help
Unique key in PG
Hey guys, sorry I have a little dumb question here 🙂 I wanna know how to set my id field in my PG to auto increament. Here's my schema;
const apiInventory = pgTable("api_inventory", {
id: serial("id").primaryKey(), //I want this to auto-increament.
// other columns and field here...
status: text("status").notNull(),
created_at: timestamp("created_at").defaultNow().notNull(),
last_modified: timestamp("last_modified").defaultNow().notNull(),
});
const apiInventory = pgTable("api_inventory", {
id: serial("id").primaryKey(), //I want this to auto-increament.
// other columns and field here...
status: text("status").notNull(),
created_at: timestamp("created_at").defaultNow().notNull(),
last_modified: timestamp("last_modified").defaultNow().notNull(),
});
Someone look this up please, not sure I've found the right docs yet.
8 replies