forked from phc/website
Remove dribble
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
import { defineConfig } from "drizzle-kit";
|
||||
|
||||
export default defineConfig({
|
||||
schema: "src/db/schema.ts",
|
||||
driver: "better-sqlite",
|
||||
out: "out/drizzle",
|
||||
});
|
||||
Generated
-12049
File diff suppressed because it is too large
Load Diff
+3
-9
@@ -3,13 +3,11 @@
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "run-s astro:sync drizzle:* astro:dev",
|
||||
"build": "run-s drizzle:generate astro:build",
|
||||
"dev": "run-s astro:sync astro:dev",
|
||||
"build": "run-s astro:build",
|
||||
"astro:sync": "astro sync",
|
||||
"astro:dev": "astro dev",
|
||||
"astro:build": "astro check && astro build",
|
||||
"drizzle:generate": "drizzle-kit generate:sqlite",
|
||||
"drizzle:migrate": "tsx src/db/migrate.ts"
|
||||
"astro:build": "astro check && astro build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.9.4",
|
||||
@@ -24,8 +22,6 @@
|
||||
"@fontsource/space-mono": "^5.0.20",
|
||||
"@preact/signals": "^1.3.0",
|
||||
"astro": "^4.15.11",
|
||||
"better-sqlite3": "^9.4.3",
|
||||
"drizzle-orm": "^0.29.4",
|
||||
"fuse.js": "^7.0.0",
|
||||
"katex": "^0.16.9",
|
||||
"preact": "^10.19.6",
|
||||
@@ -33,9 +29,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/mdx": "^3.1.7",
|
||||
"@types/better-sqlite3": "^7.6.9",
|
||||
"@types/katex": "^0.16.7",
|
||||
"drizzle-kit": "^0.20.14",
|
||||
"jsdom": "^24.1.1",
|
||||
"linkedom": "^0.18.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
|
||||
Generated
-5545
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
import { drizzle } from 'drizzle-orm/better-sqlite3'
|
||||
import Database from 'better-sqlite3'
|
||||
|
||||
const sql = new Database('out/website.sqlite')
|
||||
export const db = drizzle(sql)
|
||||
@@ -1,4 +0,0 @@
|
||||
import { migrate } from 'drizzle-orm/better-sqlite3/migrator'
|
||||
import { db } from './index'
|
||||
|
||||
migrate(db, { migrationsFolder: 'out/drizzle' })
|
||||
@@ -1,43 +0,0 @@
|
||||
import { sql } from 'drizzle-orm'
|
||||
import { text, sqliteTable } from 'drizzle-orm/sqlite-core'
|
||||
|
||||
export const users = sqliteTable('users', {
|
||||
// id è l'id unico di questo utente, non è modificabile una volta creato l'utente.
|
||||
id: text('id')
|
||||
.primaryKey()
|
||||
.default(sql`(lower(hex(randomblob(16))))`),
|
||||
|
||||
// Username è il nome leggibile di questo utente utilizzato anche per le
|
||||
// route per singolo utente, deve essere unico nel sito.
|
||||
//
|
||||
// NOTE: Quando un utente accede per la prima volta di default gli viene
|
||||
// chiesto se usare quello dell'account che sta usando o se cambiarlo
|
||||
// (in teoria non dovrebbe essere un problema poterlo modificare
|
||||
// successivamente).
|
||||
username: text('username').unique().notNull(),
|
||||
|
||||
// FullName da mostrare in giro per il sito
|
||||
fullName: text('fullname'),
|
||||
|
||||
// Email per eventuale contatto
|
||||
email: text('email'),
|
||||
})
|
||||
|
||||
export type User = typeof users.$inferSelect // return type when queried
|
||||
export type InsertUser = typeof users.$inferInsert // insert type
|
||||
|
||||
export const accounts = sqliteTable('accounts', {
|
||||
// id è l'id unico di questo account, non è modificabile una volta creato l'account.
|
||||
id: text('id').primaryKey(),
|
||||
|
||||
userId: text('userId')
|
||||
.notNull()
|
||||
.references(() => users.id),
|
||||
|
||||
provider: text('provider').$type<'poisson' | 'ateneo'>().notNull(),
|
||||
|
||||
token: text('token').notNull(),
|
||||
})
|
||||
|
||||
export type Account = typeof accounts.$inferSelect // return type when queried
|
||||
export type InsertAccount = typeof accounts.$inferInsert // insert type
|
||||
Reference in New Issue
Block a user