mirror of
https://github.com/michivonah/themepark-assistant.git
synced 2025-12-22 22:16:29 +01:00
add user creation in db & validation
This commit is contained in:
parent
807e2dc408
commit
e097d154de
5 changed files with 102 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { integer, text, sqliteTable, sqliteView } from "drizzle-orm/sqlite-core";
|
||||
import { check, integer, text, sqliteTable, sqliteView } from "drizzle-orm/sqlite-core";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
|
||||
// Tables
|
||||
|
|
@ -48,9 +48,15 @@ export const themepark = sqliteTable('themepark', {
|
|||
|
||||
export const user = sqliteTable('user', {
|
||||
id: integer().primaryKey({ autoIncrement: true }),
|
||||
username: text().notNull(),
|
||||
isActive: integer({ mode: 'boolean' }).default(false)
|
||||
})
|
||||
mail: text().notNull().unique(),
|
||||
isActive: integer({ mode: 'boolean' }).notNull().default(false),
|
||||
createdAt: integer().notNull(),
|
||||
lastActive: integer().notNull()
|
||||
},
|
||||
(table) => [
|
||||
check("mail_validation", sql`${table.mail} LIKE '%@%'`)
|
||||
]
|
||||
)
|
||||
|
||||
// Views
|
||||
export const subscribedThemeparks = sqliteView('subscribed_themeparks').as((qb) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue