const tokenCols = {
id: serial('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => usersTable.id, { onDelete: 'cascade' }),
email: text('email').notNull(),
token: text('token').notNull(),
expiresAt: timestamp('expires_at', { withTimezone: true, mode: 'date' }).notNull()
};
const timestampsCols = {
createdAt: timestamp('created_at', { mode: 'date' }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { mode: 'date' }).$onUpdate(() => new Date())
};
const coordinatesCols = {
latitude: text('latitude'),
longitude: text('longitude')
};
function lower(email: AnyPgColumn): SQL {
return sql`lower(${email})`;
}
export {lower, coordinatesCols, timestampsCols, tokenCols };
const tokenCols = {
id: serial('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => usersTable.id, { onDelete: 'cascade' }),
email: text('email').notNull(),
token: text('token').notNull(),
expiresAt: timestamp('expires_at', { withTimezone: true, mode: 'date' }).notNull()
};
const timestampsCols = {
createdAt: timestamp('created_at', { mode: 'date' }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { mode: 'date' }).$onUpdate(() => new Date())
};
const coordinatesCols = {
latitude: text('latitude'),
longitude: text('longitude')
};
function lower(email: AnyPgColumn): SQL {
return sql`lower(${email})`;
}
export {lower, coordinatesCols, timestampsCols, tokenCols };