feat: [wip] local identity db

This commit is contained in:
Shibo Lyu 2024-10-01 03:10:24 +08:00
parent 2074687692
commit 2827a1bf1f
6 changed files with 30 additions and 0 deletions

5
src/lib/db/common.ts Normal file
View file

@ -0,0 +1,5 @@
import { SQLocalDrizzle } from 'sqlocal/drizzle';
import { drizzle } from 'drizzle-orm/sqlite-proxy';
const { driver, batchDriver } = new SQLocalDrizzle('database.sqlite3');
export const db = drizzle(driver, batchDriver);

0
src/lib/db/index.ts Normal file
View file

View file

@ -0,0 +1,6 @@
import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
export const configs = sqliteTable('weblah-config', {
key: text('key').primaryKey(),
value: text('value')
});

View file

@ -0,0 +1,10 @@
import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
export const identities = sqliteTable('identities', {
idKey: text('id_key').primaryKey(),
actKeys: text('act_keys').notNull(),
profileName: text('profile_name').notNull(),
profileBio: text('profile_bio'),
preferredChatServerUrls: text('preferred_chat_server_urls').notNull(),
idUrls: text('id_urls').notNull()
});