a lot of work, but i'd guess mostly api in the works
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user