Template
Nuxt coursework boilerplate: Tailwind, Drizzle (MySQL), Redis, Pug page, Vercel deploy workflow
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { drizzle } from "drizzle-orm/mysql2";
|
||||
import * as schema from "./schema";
|
||||
|
||||
export const db = drizzle({
|
||||
connection: {
|
||||
host: process.env.MYSQL_HOST ?? "localhost",
|
||||
port: Number(process.env.MYSQL_PORT ?? 3306),
|
||||
database: process.env.MYSQL_DATABASE,
|
||||
user: process.env.MYSQL_USER,
|
||||
password: process.env.MYSQL_PASSWORD,
|
||||
},
|
||||
schema,
|
||||
mode: "default",
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import { mysqlTable, int, varchar, timestamp } from "drizzle-orm/mysql-core";
|
||||
|
||||
export const notes = mysqlTable("notes", {
|
||||
id: int("id").primaryKey().autoincrement(),
|
||||
title: varchar("title", { length: 255 }).notNull(),
|
||||
body: varchar("body", { length: 2000 }).notNull(),
|
||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||
});
|
||||
Reference in New Issue
Block a user