@authhero/kysely-adapter 10.67.0 → 10.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,50 @@
1
- # @authhero/kysely-adater
1
+ # @authhero/kysely-adapter
2
2
 
3
- A kysely-based adapter for connecting AuthHero to SQLite, postgres and MySQL.
3
+ A Kysely-based adapter for connecting AuthHero to SQLite, PostgreSQL, and MySQL.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @authhero/kysely-adapter
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Kysely } from "kysely";
15
+ import { createAdapters, migrateToLatest } from "@authhero/kysely-adapter";
16
+
17
+ // Create your Kysely instance with your preferred dialect
18
+ const db = new Kysely<Database>({
19
+ dialect: yourDialect,
20
+ });
21
+
22
+ // Run migrations
23
+ await migrateToLatest(db);
24
+
25
+ // Create adapters
26
+ const adapters = createAdapters(db);
27
+ ```
28
+
29
+ ## Exporting SQL for D1
30
+
31
+ If you're using Cloudflare D1 and prefer to use D1's native migration system instead of running Kysely migrations at runtime, you can export the migrations as raw SQL files:
32
+
33
+ ```bash
34
+ # Generate individual D1 migration files
35
+ pnpm run export-sql:d1
36
+
37
+ # Generate combined SQL file
38
+ pnpm run export-sql:combined
39
+
40
+ # Output to stdout
41
+ pnpm run export-sql
42
+ ```
43
+
44
+ The `export-sql:d1` command generates numbered SQL files in the `migrations/` directory that are compatible with `wrangler d1 migrations apply`.
45
+
46
+ ## Supported Databases
47
+
48
+ - SQLite (including Cloudflare D1)
49
+ - PostgreSQL
50
+ - MySQL