From 9d043bbf1b046d20b0f9c7208fe3b2a29b1f009f Mon Sep 17 00:00:00 2001 From: Sreekanth Nagareddy Date: Tue, 28 Jan 2025 11:59:11 +0530 Subject: [PATCH 1/4] drizzle latest --- starters/features/drizzle/drizzle.config.ts | 9 ++++---- starters/features/drizzle/drizzle/schema.ts | 24 ++++++--------------- starters/features/drizzle/package.json | 22 ++++++++++--------- 3 files changed, 23 insertions(+), 32 deletions(-) diff --git a/starters/features/drizzle/drizzle.config.ts b/starters/features/drizzle/drizzle.config.ts index a9b9455bed0..193ed3d4d27 100644 --- a/starters/features/drizzle/drizzle.config.ts +++ b/starters/features/drizzle/drizzle.config.ts @@ -1,9 +1,10 @@ -import type { Config } from "drizzle-kit"; -export default { +import { defineConfig } from "drizzle-kit"; + +export default defineConfig({ + dialect: "sqlite", schema: "./drizzle/schema.ts", out: "./drizzle/migrations/", - driver: "better-sqlite", dbCredentials: { url: "./drizzle/db/db.sqlite", }, -} satisfies Config; +}); diff --git a/starters/features/drizzle/drizzle/schema.ts b/starters/features/drizzle/drizzle/schema.ts index 6b64a720465..6af36fdcd33 100644 --- a/starters/features/drizzle/drizzle/schema.ts +++ b/starters/features/drizzle/drizzle/schema.ts @@ -1,22 +1,10 @@ -// // This is your drizzle schema file. +import { sqliteTable as table } from "drizzle-orm/sqlite-core"; +import * as t from "drizzle-orm/sqlite-core"; -// import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core"; - -// export const users = pgTable("users", { -// id: serial("id").primaryKey(), -// name: text("name").default("not_provided"), -// email: text("email").notNull(), -// }); - -// export const schema = { -// users, -// }; -import { sqliteTable, integer, text } from "drizzle-orm/sqlite-core"; - -export const users = sqliteTable("users", { - id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }), - name: text("name").default("not_provided"), - email: text("email").notNull(), +export const users = table("users", { + id: t.int({ mode: "number" }).primaryKey({ autoIncrement: true }), + name: t.text().default("not_provided"), + email: t.text().notNull(), }); export const schema = { diff --git a/starters/features/drizzle/package.json b/starters/features/drizzle/package.json index 91f11a52909..f582fc29a32 100644 --- a/starters/features/drizzle/package.json +++ b/starters/features/drizzle/package.json @@ -26,17 +26,19 @@ "alwaysInRoot": [] }, "devDependencies": { - "@types/better-sqlite3": "^7.6.9", - "drizzle-kit": "^0.20.14" - }, - "dependencies": { - "better-sqlite3": "^9.4.3", - "drizzle-orm": "^0.29.4" + "@types/better-sqlite3": "^7.6.12", + "drizzle-kit": "^0.30.3", + "better-sqlite3": "^11.8.1", + "drizzle-orm": "^0.39.0" }, "scripts": { - "postinstall": "drizzle-kit generate:sqlite", - "drizzle:generate": "drizzle-kit generate:sqlite", - "drizzle:migrate": "drizzle-kit push:sqlite", - "drizzle:studio": "drizzle-kit studio --host 127.0.0.1" + "drizzle:generate": "drizzle-kit generate", + "drizzle:migrate": "drizzle-kit migrate", + "drizzle:push": "drizzle-kit push", + "drizzle:pull": "drizzle-kit pull", + "drizzle:check": "drizzle-kit check", + "drizzle:up": "drizzle-kit up", + "drizzle:studio": "drizzle-kit studio", + "postinstall": "drizzle-kit generate" } } From a7f961c9148762010f47746c0c1fb6efd47d5d57 Mon Sep 17 00:00:00 2001 From: Sreekanth Nagareddy Date: Tue, 28 Jan 2025 14:01:34 +0530 Subject: [PATCH 2/4] docs fix --- starters/features/drizzle/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starters/features/drizzle/package.json b/starters/features/drizzle/package.json index f582fc29a32..5de40474fcb 100644 --- a/starters/features/drizzle/package.json +++ b/starters/features/drizzle/package.json @@ -5,7 +5,7 @@ "priority": -10, "viteConfig": {}, "docs": [ - "https://qwik.dev/integrations/integration/drizzle/", + "https://qwik.dev/integrations/drizzle/", "https://orm.drizzle.team/docs/overview" ], "nextSteps": { From 840e98581d4875bd269ce516096ba1e2c9c98337 Mon Sep 17 00:00:00 2001 From: Sreekanth Nagareddy Date: Tue, 28 Jan 2025 14:19:46 +0530 Subject: [PATCH 3/4] change set --- .changeset/forty-bats-rule.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/forty-bats-rule.md diff --git a/.changeset/forty-bats-rule.md b/.changeset/forty-bats-rule.md new file mode 100644 index 00000000000..cc090a9242b --- /dev/null +++ b/.changeset/forty-bats-rule.md @@ -0,0 +1,5 @@ +--- +'@builder.io/qwik': patch +--- + +updated drizzle to latest version From 4f5a3937b09348b678b3d691cbdabeaa06e0b4b8 Mon Sep 17 00:00:00 2001 From: gioboa Date: Wed, 29 Jan 2025 10:25:21 +0100 Subject: [PATCH 4/4] chore: add installation hint --- starters/features/drizzle/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/starters/features/drizzle/package.json b/starters/features/drizzle/package.json index 5de40474fcb..a69ab11f7d7 100644 --- a/starters/features/drizzle/package.json +++ b/starters/features/drizzle/package.json @@ -12,6 +12,7 @@ "title": "Next Steps", "lines": [ " Drizzle was installed with a simple DB schema and some demo routes,", + " now you need to run `npm run drizzle:migrate` to setup the database.", "", " better-sqlite3 was configured by default, but in production", " you'll want to use Postgres or MySQL.",