just a template from sv with drizzle + lucia demos
This commit is contained in:
commit
53728f4903
33 changed files with 1628 additions and 0 deletions
20
src/lib/server/db/schema.ts
Normal file
20
src/lib/server/db/schema.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { sqliteTable, integer, text } from 'drizzle-orm/sqlite-core';
|
||||
|
||||
export const user = sqliteTable('user', {
|
||||
id: text('id').primaryKey(),
|
||||
age: integer('age'),
|
||||
username: text('username').notNull().unique(),
|
||||
passwordHash: text('password_hash').notNull()
|
||||
});
|
||||
|
||||
export const session = sqliteTable('session', {
|
||||
id: text('id').primaryKey(),
|
||||
userId: text('user_id')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
expiresAt: integer('expires_at', { mode: 'timestamp' }).notNull()
|
||||
});
|
||||
|
||||
export type Session = typeof session.$inferSelect;
|
||||
|
||||
export type User = typeof user.$inferSelect;
|
||||
Loading…
Add table
Add a link
Reference in a new issue