export const User = pgTable(
'user',
{
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
email: varchar('phone', { length: 256 }),
password: text('password'),
createdAt: timestamp('created_at', { withTimezone: true })
.notNull()
.defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true })
.notNull()
.defaultNow(),
},
(user) => {
return { idIdx: index('id_idx').on(user.id) };
},
);
export const UserRelation = relations(User, ({ many }) => ({
shops: many(Shop),
products: many(Product),
}));
export type NewUser = InferModel<typeof User, 'insert'>;
export type Users = InferModel<typeof User>;
export const User = pgTable(
'user',
{
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
email: varchar('phone', { length: 256 }),
password: text('password'),
createdAt: timestamp('created_at', { withTimezone: true })
.notNull()
.defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true })
.notNull()
.defaultNow(),
},
(user) => {
return { idIdx: index('id_idx').on(user.id) };
},
);
export const UserRelation = relations(User, ({ many }) => ({
shops: many(Shop),
products: many(Product),
}));
export type NewUser = InferModel<typeof User, 'insert'>;
export type Users = InferModel<typeof User>;