Skip to content

Commit

Permalink
feat(playground): add drizzle studio
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienZ committed Sep 3, 2024
1 parent 444b30e commit 479125e
Show file tree
Hide file tree
Showing 4 changed files with 578 additions and 8 deletions.
13 changes: 13 additions & 0 deletions playground/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "drizzle-kit";
import path from "node:path";

export default defineConfig({
// out: "./server/database/migrations",
// schema: "./server/database/schema/index.ts",
dialect: "sqlite",
dbCredentials: {
url: path.resolve(__dirname, ".data/db.sqlite3"),
},
verbose: true,
strict: true,
});
34 changes: 34 additions & 0 deletions playground/modules/drizzle-studio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineNuxtModule } from "nuxt/kit";
import { addCustomTab, startSubprocess } from "@nuxt/devtools-kit";

export default defineNuxtModule({
meta: {
name: "drizzle-studio",
},
setup(_options, nuxt) {
if (!nuxt.options.dev) {
return;
}

startSubprocess(
{
command: "pnpm",
args: ["exec", "drizzle-kit", "studio"],
},
{
id: "nuxt-drizzle-kit--studio",
name: "Drizzle Studio",
},
);

addCustomTab({
name: "dizzle-studio",
title: "Drizzle Studio",
icon: "simple-icons:drizzle",
view: {
type: "iframe",
src: "https://local.drizzle.studio",
},
});
},
});
3 changes: 3 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
},
"dependencies": {
"nuxt": "^3.12.4"
},
"devDependencies": {
"drizzle-kit": "^0.24.2"
}
}
Loading

0 comments on commit 479125e

Please sign in to comment.