a lot of work, but i'd guess mostly api in the works

This commit is contained in:
2026-05-27 20:45:14 +02:00
parent 68458be71f
commit 50872d8951
22 changed files with 1425 additions and 1257 deletions
+19
View File
@@ -0,0 +1,19 @@
import { customType } from 'drizzle-orm/mysql-core';
export const mediumblob = customType<{
data: Buffer;
driverData: Buffer;
}>({
dataType() {
return 'MEDIUMBLOB';
}
});
export const longblob = customType<{
data: Buffer;
driverData: Buffer;
}>({
dataType() {
return 'LONGBLOB';
}
});
+72 -5
View File
@@ -1,4 +1,16 @@
import { mysqlTable, serial, int, text, tinyint } from 'drizzle-orm/mysql-core';
import {
boolean,
char,
int,
longtext,
mysqlTable,
serial,
text,
timestamp,
tinyint,
varchar
} from 'drizzle-orm/mysql-core';
import { longblob, mediumblob } from './custom-types';
export const task = mysqlTable('task', {
id: serial('id').primaryKey(),
@@ -6,10 +18,65 @@ export const task = mysqlTable('task', {
priority: int('priority').notNull().default(1)
});
export const settings = mysqlTable('settings', {
var: text('var').notNull().unique(),
state: tinyint('state')
export const config = mysqlTable('config', {
key: varchar('key', { length: 64 }).primaryKey(),
value: longtext('value').notNull()
});
export type Setting = typeof settings.$inferSelect;
export const projects = mysqlTable('projects', {
id: tinyint('id').notNull().primaryKey().autoincrement(),
name: text('name').notNull(),
data: longtext('data', {}).notNull(),
enabled: tinyint('enabled').notNull()
});
export const locales = mysqlTable('locales', {
code: char('code').notNull().unique(),
name: char('name').notNull(),
dictionary: longtext().notNull(),
flag: longtext('').notNull(),
enabled: tinyint('enabled').notNull()
});
export const groups = mysqlTable('groups', {
gid: int('gid').primaryKey().autoincrement(),
name: varchar('name', { length: 32 }).notNull().unique()
});
export const users = mysqlTable('users', {
uid: int('uid').primaryKey().autoincrement(),
username: varchar('username', { length: 32 }).notNull().unique(),
password: varchar('password', { length: 128 }).notNull(),
home: int('home').notNull(),
gid: int('gid')
.notNull()
.references(() => groups.gid),
accessible: boolean('accessible').notNull(),
face: mediumblob('face')
});
export const filesystem = mysqlTable(
'filesystem',
{
id: int('id').primaryKey().default(1),
data: longtext('data').notNull(),
checksum: varchar('checksum', { length: 32 }).notNull(),
updatedAt: timestamp('updated_at').defaultNow().onUpdateNow()
} /* ,
{
// Ensures only one row can exist
singleRow: check('single_row_check', `id = 1`)
} */
);
export const fileContents = mysqlTable('file_contents', {
guid: varchar('guid', { length: 36 }).primaryKey(),
data: longblob('data').notNull(),
mimeType: varchar('mime_type', { length: 127 }).default('text/plain')
});
export const allowList = mysqlTable('allow_list', {
ip: int('ip').notNull()
});
export type Config = typeof config.$inferSelect;