ionian/packages/dbtype/types.ts
2024-03-29 00:19:36 +09:00

54 lines
1.0 KiB
TypeScript

import type { ColumnType } from "kysely";
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;
export interface DocTagRelation {
doc_id: number;
tag_name: string;
}
export interface Document {
additional: string | null;
basepath: string;
content_hash: string | null;
content_type: string;
created_at: number;
deleted_at: number | null;
filename: string;
id: Generated<number>;
modified_at: number;
title: string;
}
export interface Permissions {
name: string;
username: string;
}
export interface SchemaMigration {
dirty: number | null;
version: string | null;
}
export interface Tags {
description: string | null;
name: string;
}
export interface Users {
password_hash: string;
password_salt: string;
username: string | null;
}
export interface DB {
doc_tag_relation: DocTagRelation;
document: Document;
permissions: Permissions;
schema_migration: SchemaMigration;
tags: Tags;
users: Users;
}