code stable. terminal initializes, database successfully connects, reads and writes. css on maintenance page needs tweaking. terminal still displays before initialization.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { drizzle } from 'drizzle-orm/mysql2';
|
||||
import mysql from 'mysql2/promise';
|
||||
import * as schema from './schema';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
|
||||
|
||||
const client = mysql.createPool(env.DATABASE_URL);
|
||||
|
||||
export const db = drizzle(client, { schema, mode: 'default', logger: true });
|
||||
@@ -0,0 +1,15 @@
|
||||
import { mysqlTable, serial, int, text, tinyint } from 'drizzle-orm/mysql-core';
|
||||
|
||||
export const task = mysqlTable('task', {
|
||||
id: serial('id').primaryKey(),
|
||||
title: text('title').notNull(),
|
||||
priority: int('priority').notNull().default(1)
|
||||
});
|
||||
|
||||
export const settings = mysqlTable('settings', {
|
||||
var: text('var').notNull().unique(),
|
||||
state: tinyint('state')
|
||||
});
|
||||
|
||||
export type Setting = typeof settings.$inferSelect;
|
||||
|
||||
Reference in New Issue
Block a user